osule / django-envie

A django module to allows the use of environment variables set in an env.py file

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Django-Envie

codeclimate travis-ci pypi-version-image

This module helps to set environment variable for your Django application from a .env.py or .env.yml file placed inside the project directory.

Installation

pip install django-envie

Usage

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).

Configuration

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 your environment variables

Accessing environment variables anywhere can be done by using

os.getenv('DB_NAME')

Setting up your environment variable for Continuous Integration

CircleCI

KEY = VALUE

TravisCI

KEY = "VALUE"

Checkout the documentation for this project here

About

A django module to allows the use of environment variables set in an env.py file


Languages

Language:Python 100.0%