Last active
February 4, 2017 22:06
-
-
Save agriffis/c3c4905787ee4435cf6965172adc7d73 to your computer and use it in GitHub Desktop.
envbash/bienvenue example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bienvenue import make_env_reader | |
from envbash import load_envbash | |
# Where are we? | |
DREAMHOST = 'dreamhost' in open('/etc/resolv.conf').read() | |
DEVELOPMENT = not DREAMHOST | |
# Load env.bash | |
if DREAMHOST: | |
load_envbash(os.path.expanduser('~/env.bash')) | |
elif DEVELOPMENT: | |
load_envbash(os.path.join(BASE_DIR, 'env.bash'), missing_ok=True) | |
# Make an env reader to convert strings to inferred types | |
env = make_env_reader(prefix='DJANGO_') | |
# Django settings | |
SECRET_KEY = env('SECRET_KEY', 'dev-sekrit') | |
DEBUG = env('DEBUG', DEVELOPMENT) | |
ALLOWED_HOSTS = env('ALLOWED_HOSTS', []) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment