Skip to content
This repository has been archived by the owner on Dec 27, 2018. It is now read-only.

sloria/read_env

Repository files navigation

read_env

Latest version

Travis-CI

read_env reads .env.

Install

pip install read_env

Usage

Add variables to a .env file in your project.

# myapp/.env
DEBUG=true
PORT=5000

Call read_env to add the variables to os.environ.

# myapp/env.py
import os
from read_env import read_env

read_env()

assert os.environ['DEBUG'] == 'true'
assert int(os.environ['PORT']) == 5000

Changelog

1.1.0 (2016-05-01)

  • Add recurse parameter (defaults to True).
  • If .env file doesn't exist at given path, recurse up the directory tree (by default).

1.0.0 (2016-04-30)

  • First PyPI release.

Check out environs for parsing environment variables.

License

MIT