diff options
Diffstat (limited to 'app/app/settings.py')
| -rw-r--r-- | app/app/settings.py | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/app/app/settings.py b/app/app/settings.py index d472675..f143931 100644 --- a/app/app/settings.py +++ b/app/app/settings.py @@ -16,20 +16,37 @@ import yaml # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -CONFIG = yaml.load(open(BASE_DIR + '/config.yml').read()) + +def get_default_config(): + return yaml.load(open(BASE_DIR + '/config.yml').read()) + + +CONFIG = {} + +if os.environ.get('CUSTOM_CONFIG'): + try: + fn = "{}/{}".format(BASE_DIR, os.environ.get('CUSTOM_CONFIG')) + CONFIG = yaml.load(open(fn)) + except Exception as e: + print("WARNING: Loading default configuration. \n{}".format(e)) + CONFIG = get_default_config() +else: + CONFIG = get_default_config() # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'h$r_bwlp@#h#y#%&qhw-n=gb2%wva1d_h65+o94u&!a#%iv&lo' +SECRET_KEY = CONFIG['SECRET_KEY'] # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +DEBUG = CONFIG['debug'] ALLOWED_HOSTS = CONFIG['allowed_hosts'] +ADMINS = CONFIG['admins'] + # Application definition |
