pip install python-decouple
python
from decouple import config
DB_HOST=localhost
DB_PORT=5432
DB_NAME=mydatabase
DB_USER=myusername
DB_PASSWORD=mypassword
DEBUG=True
SECRET_KEY=mysecretkey
python
db_host = config('DB_HOST')
db_port = config('DB_PORT')
db_name = config('DB_NAME')
debug = config('DEBUG')
secret_key = config('SECRET_KEY')
python
db_host = config('DB_HOST', default='localhost')
db_port = config('DB_PORT', default=5432, cast=int)
db_name = config('DB_NAME', default='mydatabase')
debug = config('DEBUG', default=True, cast=bool)
secret_key = config('SECRET_KEY')