On this page
article
Read Environment Variables
Load config from environment with defaults.
Category: os
Problem
Load config from environment with defaults.
Solution
debug = os.getenv("DEBUG", "false").lower() == "true"
Notes
- Adapt variable names and paths to your project
- Add error handling for production use
- See related chapters in the Learning Path