Commit 7bb0c082 authored by chris's avatar chris

mysite/common_settings.py: refactor default settings 2/2 (be explicit here not...

mysite/common_settings.py: refactor default settings 2/2 (be explicit here not using config.options('DJANGO_SETTINGS'))
parent bdf41676
......@@ -63,28 +63,35 @@ except IOError:
print ("Unable to open %s settings" % (conf_file_name,))
raise SystemExit(-1)
DJANGO_SETTINGS_ADMIN_EMAIL = config.get('DJANGO_SETTINGS', 'DJANGO_SETTINGS_ADMIN_EMAIL')
DJANGO_SETTINGS_ADMIN_NAME = config.get('DJANGO_SETTINGS', 'DJANGO_SETTINGS_ADMIN_NAME')
DJANGO_SETTINGS_DATABASE_HOST = config.get('DJANGO_SETTINGS', 'DJANGO_SETTINGS_DATABASE_HOST')
DJANGO_SETTINGS_DATABASE_NAME = config.get('DJANGO_SETTINGS', 'DJANGO_SETTINGS_DATABASE_NAME')
DJANGO_SETTINGS_DATABASE_PASSWORD = config.get('DJANGO_SETTINGS', 'DJANGO_SETTINGS_DATABASE_PASSWORD')
DJANGO_SETTINGS_DATABASE_PORT = config.getint('DJANGO_SETTINGS', 'DJANGO_SETTINGS_DATABASE_PORT')
DJANGO_SETTINGS_DATABASE_USER = config.get('DJANGO_SETTINGS', 'DJANGO_SETTINGS_DATABASE_USER')
DJANGO_SETTINGS_DEBUG = config.getboolean('DJANGO_SETTINGS', 'DJANGO_SETTINGS_DEBUG')
DJANGO_SETTINGS_DEMO = config.getboolean('DJANGO_SETTINGS', 'DJANGO_SETTINGS_DEMO')
DJANGO_SETTINGS_EMAIL_HOST = config.get('DJANGO_SETTINGS', 'DJANGO_SETTINGS_EMAIL_HOST')
DJANGO_SETTINGS_EMAIL_HOST_PASSWORD = config.get('DJANGO_SETTINGS', 'DJANGO_SETTINGS_EMAIL_HOST_PASSWORD')
DJANGO_SETTINGS_EMAIL_HOST_USER = config.get('DJANGO_SETTINGS', 'DJANGO_SETTINGS_EMAIL_HOST_USER')
DJANGO_SETTINGS_EMAIL_PORT = config.getint('DJANGO_SETTINGS', 'DJANGO_SETTINGS_EMAIL_PORT')
DJANGO_SETTINGS_EMAIL_USE_SSL = config.getboolean('DJANGO_SETTINGS', 'DJANGO_SETTINGS_EMAIL_USE_TLS')
DJANGO_SETTINGS_EMAIL_USE_TLS = config.getboolean('DJANGO_SETTINGS', 'DJANGO_SETTINGS_EMAIL_USE_TLS')
DJANGO_SETTINGS_ENV = config.get('DJANGO_SETTINGS', 'DJANGO_SETTINGS_ENV')
DJANGO_SETTINGS_LANGUAGE = config.get('DJANGO_SETTINGS', 'DJANGO_SETTINGS_LANGUAGE')
DJANGO_SETTINGS_LOGGING = config.getboolean('DJANGO_SETTINGS', 'DJANGO_SETTINGS_LOGGING')
DJANGO_SETTINGS_CACHE = config.get('DJANGO_SETTINGS', 'DJANGO_SETTINGS_CACHE')
DJANGO_SETTINGS_SESSION = config.get('DJANGO_SETTINGS', 'DJANGO_SETTINGS_SESSION')
DJANGO_SETTINGS_COUNTRY = config.get('DJANGO_SETTINGS', 'DJANGO_SETTINGS_COUNTRY')
DJANGO_SETTINGS_IS_MINIMALIST = config.getboolean('DJANGO_SETTINGS', 'DJANGO_SETTINGS_IS_MINIMALIST')
OPTIONS = ('DJANGO_SETTINGS_ADMIN_EMAIL',
'DJANGO_SETTINGS_ADMIN_NAME',
'DJANGO_SETTINGS_DATABASE_HOST',
'DJANGO_SETTINGS_DATABASE_NAME',
'DJANGO_SETTINGS_DATABASE_PASSWORD',
'DJANGO_SETTINGS_DATABASE_PORT',
'DJANGO_SETTINGS_DATABASE_USER',
'DJANGO_SETTINGS_DEBUG',
'DJANGO_SETTINGS_DEMO',
'DJANGO_SETTINGS_EMAIL_HOST',
'DJANGO_SETTINGS_EMAIL_HOST_PASSWORD',
'DJANGO_SETTINGS_EMAIL_HOST_USER',
'DJANGO_SETTINGS_EMAIL_PORT',
'DJANGO_SETTINGS_EMAIL_USE_SSL',
'DJANGO_SETTINGS_EMAIL_USE_TLS',
'DJANGO_SETTINGS_ENV',
'DJANGO_SETTINGS_LANGUAGE',
'DJANGO_SETTINGS_LOGGING',
'DJANGO_SETTINGS_CACHE',
'DJANGO_SETTINGS_SESSION',
'DJANGO_SETTINGS_COUNTRY',
'DJANGO_SETTINGS_IS_MINIMALIST')
for OPTION in OPTIONS:
try:
globals()[OPTION] = config.get('DJANGO_SETTINGS', OPTION)
except configparser.NoOptionError:
pass
DJANGO_STATIC = config.get('DJANGO_SETTINGS', 'DJANGO_SETTINGS_STATIC')
DJANGO_SETTINGS_ALLOWED_HOSTS = []
for name in config.options('ALLOWED_HOSTS'):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment