Created
April 29, 2011 19:23
-
-
Save phill-tornroth/948855 to your computer and use it in GitHub Desktop.
Django settings_local handler.
This file contains hidden or 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
# For local dev purposes, allow for importing of add'l settings from | |
# a settings_local.py file (over-rides any already set above) | |
if DEBUG: | |
try: | |
from settings_local import * | |
except ImportError: | |
pass | |
else: | |
# Special treatment for symbols in settings_local that begin with 'EXTRA_'. | |
# Those are sequences that will be appended to the ones we've got already. | |
import re | |
import settings_local | |
for attr in dir(settings_local): | |
match = re.search('^EXTRA_(\w+)', attr) | |
if match: | |
name = match.group(1) | |
value = getattr(settings_local, attr) | |
if name in globals(): | |
globals()[name] += value | |
else: | |
globals()[name] = value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment