0PricingLogin
Flask Academy · Lesson

Load Secrets from Environment Variables

Keep keys out of source with env vars.

Secrets Do Not Belong in Code

API keys and passwords pasted into source files leak the moment you push to Git. Keep secrets out of your repository entirely.

The Twelve-Factor Idea

The twelve-factor approach stores config in the environment, so the same code ships everywhere with no edits.

All lessons in this course

  1. Config Classes per Environment
  2. Load Secrets from Environment Variables
  3. Use dotenv in Development
  4. Toggle Debug and Feature Flags
← Back to Flask Academy