Created
December 16, 2014 11:20
-
-
Save guilhem/465a736727e6bfc1fbf6 to your computer and use it in GitHub Desktop.
Load django settings from environment variables
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
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