Initialize default settings if they are missing in the setting module

(imported from commit 97eb19c603436d460ad1832827dc3ec34c36bf31)
This commit is contained in:
Leo Franchi
2013-10-23 17:39:22 -04:00
parent a2a1867f25
commit a9bd2743f0
2 changed files with 12 additions and 3 deletions

View File

@@ -66,9 +66,6 @@ elif DEPLOYED:
else:
EXTERNAL_HOST = 'localhost:9991'
# TODO: Make this not required
EMBEDLY_KEY=""
# TODO: Replace these
S3_KEY=""
S3_SECRET_KEY=""

View File

@@ -196,6 +196,18 @@ RATE_LIMITING_RULES = [
(60, 100), # 100 requests max every minute
]
# For any settings that are not defined in local_settings.py,
# we want to initialize them to sane default
DEFAULT_SETTINGS = {'TWITTER_CONSUMER_KEY': '',
'TWITTER_CONSUMER_SECRET': '',
'TWITTER_ACCESS_TOKEN_KEY': '',
'TWITTER_ACCESS_TOKEN_SECRET': '',
'EMBEDLY_KEY': ''}
for setting_name, setting_val in DEFAULT_SETTINGS.iteritems():
if not setting_name in vars():
vars()[setting_name] = setting_val
# Static files and minification
STATIC_URL = '/static/'