Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@agriffis
Last active February 4, 2017 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agriffis/c3c4905787ee4435cf6965172adc7d73 to your computer and use it in GitHub Desktop.
Save agriffis/c3c4905787ee4435cf6965172adc7d73 to your computer and use it in GitHub Desktop.
envbash/bienvenue example
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