Performance: Configuration management
MEDIUM IMPACT
This affects the app startup time and memory usage by managing how configuration data is loaded and accessed.
import os class Config: SECRET_KEY = os.getenv('SECRET_KEY', 'default') DEBUG = False app.config.from_object(Config) # Use environment variables and simple config classes to keep config lightweight
app.config.from_pyfile('config.py') # config.py contains heavy computations or large data structures # Configuration is loaded synchronously at startup with heavy processing
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Heavy synchronous config file loading | 0 | 0 | Blocks initial server response causing delayed LCP | [X] Bad |
| Lightweight config via environment variables and classes | 0 | 0 | Minimal startup delay, faster initial response | [OK] Good |