| Framework/Library | Typical .env.python.local content |
|------------------|--------------------------------------|
| Django | SECRET_KEY, DEBUG=True, DATABASE_URL, ALLOWED_HOSTS=localhost |
| Flask/FastAPI | FLASK_APP, FLASK_ENV=development, DATABASE_URL, SECRET_KEY |
| General Python | API_KEY, LOG_LEVEL=DEBUG, REDIS_URL, S3_BUCKET |
The .local suffix is the most critical part. In almost every Python project setup guide (Django, FastAPI, Flask), the .gitignore file explicitly includes *.local or .env.python.local. This ensures that your personal local settings—like your local database path, a debugger port, or a temporary API key—do not accidentally sync to the repository and overwrite another developer's environment. .env.python.local
| Approach | When to use |
|----------|-------------|
| System environment variables | CI/CD, production servers |
| django-environ with .env | Django-specific projects |
| Python config.py module | Simple scripts without secrets |
| Vault/Secrets Manager | Production secrets management |
| .bashrc / *.profile | Shell-wide variables (not project-specific) | | Framework/Library | Typical