Performance: Environment variable management
MEDIUM IMPACT
This affects the app startup time and runtime configuration loading, impacting initial page load and responsiveness.
import os # Load environment variables once at startup SECRET_KEY = os.getenv('SECRET_KEY') DATABASE_URL = os.getenv('DATABASE_URL') app.config.update(SECRET_KEY=SECRET_KEY, DATABASE_URL=DATABASE_URL) # Use cached config values during requests
import os app.config['SECRET_KEY'] = os.getenv('SECRET_KEY') app.config['DATABASE_URL'] = os.getenv('DATABASE_URL') # Accessing os.getenv multiple times during request handling
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Repeated os.getenv calls during requests | Minimal | 0 | 0 | [X] Bad |
| Load env vars once at startup and cache | Minimal | 0 | 0 | [OK] Good |