From 49f64b9108977b49cdc04f8e1f30d72da242a29a Mon Sep 17 00:00:00 2001 From: andis Date: Fri, 18 Sep 2020 04:30:35 +0000 Subject: [PATCH] use environ for environment variables --- fet2020/fet2020/settings.py | 17 ++++++++++++----- fet2020/requirements.txt | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/fet2020/fet2020/settings.py b/fet2020/fet2020/settings.py index e01128cd..beea82a1 100644 --- a/fet2020/fet2020/settings.py +++ b/fet2020/fet2020/settings.py @@ -11,6 +11,11 @@ https://docs.djangoproject.com/en/3.0/ref/settings/ """ import os +import environ +env = environ.Env( + # set casting, default value + DEBUG=(bool, True) +) # Prints and logs are written to console # TODO: Change before release @@ -37,13 +42,15 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ -# SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'r37-i7l)vrduzz2-gira+z#u!p!di9#f+%s*5-bb($hg)55@ns' - # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +DEBUG = env('DEBUG') +if DEBUG: +# SECURITY WARNING: keep the secret key used in production secret! + SECRET_KEY = 'r37-i7l)vrduzz2-gira+z#u!p!di9#f+%s*5-bb($hg)55@ns' +else: + SECRET_KEY = env('SECRET_KEY') -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ["127.0.0.1", "localhost"] DATA_UPLOAD_MAX_MEMORY_SIZE = 1024 * 1024 * 1024 # Application definition diff --git a/fet2020/requirements.txt b/fet2020/requirements.txt index 0bf01482..aa82a08e 100644 --- a/fet2020/requirements.txt +++ b/fet2020/requirements.txt @@ -8,4 +8,4 @@ docutils==0.16 easy-thumbnails==2.7.0 etherpad-lite==0.5 django-filter -ldap3 \ No newline at end of file +ldap3django-environ