This module helps to set environment variable for your Django application from a .env.py or .env.yml file placed inside the project directory.
pip install django-envie
To use, create an environment file, save as either a .env.py or .env.yml file format in your django project (inside the project directory) or repository root (outside the project directory).
The .env.py file for a django project should be formatted this way:
DB_NAME = "sector_seven"
DB_USER = "homer_simpson"
DB_PASSWORD = "Close, but you're way off."
If using .env.yml file format
DB_NAME: "sector_seven"
DB_USER: "homer_simpson"
DB_PASSWORD: "Close, but you're way off."
In the project settings script, include this snippet:
from django_envie import load_vars
load_vars()
Accessing environment variables anywhere can be done by using
os.getenv('DB_NAME')
KEY = VALUE
KEY = "VALUE"
Checkout the documentation for this project here