Skip to main content

handle the environment variables as from a file in a simpler way.

Project description

A install

pip install django-envfile

Created file .env

DJANGO_SECRET_KEY="ko8n3#^m#67+p@bvx#1xp0om+!zo@&l8-*8n(c#47n)=!3t$hd"
DJANGO_DATABASE_HOST=database
DJANGO_DATABASE_NAME=cerezo_master

In settings.py

from pathlib import Path
from os.path import join, abspath
from envfile import loadenv # django-envfile

BASE_DIR = Path(__file__).parent.parent  # src

location = lambda path: abspath(join(BASE_DIR, path))
loadenv(location('.env')) # Paths file .env

SECRET_KEY = os.environ.get("DJANGO_SECRET_KEY", "Ahri")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-envfile-0.1.5.tar.gz (2.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page