Skip to content

Instantly share code, notes, and snippets.

@guilhem
Created December 16, 2014 11:20
Show Gist options
  • Save guilhem/465a736727e6bfc1fbf6 to your computer and use it in GitHub Desktop.
Save guilhem/465a736727e6bfc1fbf6 to your computer and use it in GitHub Desktop.
Load django settings from environment variables
ENV_PREFIX = 'PREFIX_'
# Load settings from environment variables
for key, value in os.environ.iteritems():
if key.startswith(ENV_PREFIX):
globals()[key.split(ENV_PREFIX)[1]] = value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment