.env.python.local [2021]
Never bundle or deploy .env.python.local to staging or production systems. This file is intended strictly for local development environments.
This file is for . If your laptop is stolen or someone gains access to your local file system, they should only find development keys, not AWS root credentials or production database passwords.
To understand its purpose, it helps to understand the standard environment file hierarchy: .env.python.local
db_host = os.getenv('DB_HOST') db_port = os.getenv('DB_PORT') db_username = os.getenv('DB_USERNAME') db_password = os.getenv('DB_PASSWORD')
To solve this, developers use environment variables. While a standard .env file handles general configurations, a .env.python.local file offers a more targeted, secure, and flexible way to manage your local Python development environment. What is a .env.python.local File? Never bundle or deploy
– Avoid reading .env files in production; rely on the operating system's environment variables for faster access.
Add to .gitignore :
– Copying .env files into Docker images bakes secrets into image layers, which persist across environments. Use build arguments or runtime environment variables instead.