Performance: Environment-based configuration
MEDIUM IMPACT
This affects the app startup time and memory usage by controlling which settings and resources load depending on the environment.
import os env = os.getenv('FLASK_ENV', 'production') app.config.from_pyfile(f'config_{env}.py') # load only relevant config
app.config.from_pyfile('config.py') # single config file with all settings # app loads all settings regardless of environment
| Pattern | Config Load Time | Memory Usage | Startup Delay | Verdict |
|---|---|---|---|---|
| Single large config file | High | High | Longer startup | [X] Bad |
| Environment-specific config files | Low | Low | Faster startup | [OK] Good |