read_env reads .env.
pip install read_env
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
- Add
recurse
parameter (defaults toTrue
). - If
.env
file doesn't exist at givenpath
, recurse up the directory tree (by default).
- First PyPI release.
Check out environs for parsing environment variables.
MIT