Environment variables
Config that changes between environments. Never hardcode secrets in source.
Code example
import os
SECRET_KEY = os.getenv('SECRET_KEY', 'dev-default')
DATABASE_URL = os.getenv('DATABASE_URL', 'sqlite:///local.db')
DEBUG = os.getenv('DEBUG', 'True').lower() == 'true'
How it works
Every environment (laptop, staging, prod) needs different config: different DB URLs, different secret keys, different log levels. Hardcoding them in source means you'd have to edit code between deploys. Env vars solve this: the same code reads os.getenv() and gets different values depending on where it runs. Secrets (SECRET_KEY, DATABASE_URL) are set in the Render dashboard, never committed to git. The .env file is for local dev only and is gitignored.
🔍 Where this is used in OpenBenchML
app/config.py — every setting reads from os.getenv() with a safe default.