From b057fedb5f1b0542ec3483d83cf5597c13f028d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Sun, 17 Nov 2024 13:55:33 +0100 Subject: [PATCH] Add optional env variable DJANGO_FORCE_DEV_MODE to force production settings to dev mode for debugging --- .../shimatta_kenkyusho/settings_production.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/shimatta_kenkyusho/shimatta_kenkyusho/settings_production.py b/shimatta_kenkyusho/shimatta_kenkyusho/settings_production.py index 901bdc1..2775540 100644 --- a/shimatta_kenkyusho/shimatta_kenkyusho/settings_production.py +++ b/shimatta_kenkyusho/shimatta_kenkyusho/settings_production.py @@ -16,9 +16,13 @@ The following environment variables have to be set: - DJANGO_MEDIA_URL - DJANGO_MEDIA_ROOT - DJANGO_POSTGRESQL_SOCKET +- DJANGO_POSTGRESQL_PORT The following can be set +- DJANGO_POSTGRESQL_PW (assumed empty if missing) +- DJANGO_POSTGRESQL_USER (assmumed empty if mssing) - DJANGO_SECURE_HSTS_SECONDS (defaults to 120) +- DJANGO_FORCE_DEV_MODE """ @@ -46,8 +50,11 @@ SECRET_KEY = get_env_value('DJANGO_SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False +if get_env_value('DJANGO_FORCE_DEV_MODE', default=False) == 'True': + DEBUG = True -ALLOWED_HOSTS = ['localhost', get_env_value('DJANGO_ALLOWED_HOST')] + +ALLOWED_HOSTS = ['127.0.0.1', 'localhost', get_env_value('DJANGO_ALLOWED_HOST')] # Application definition @@ -232,4 +239,4 @@ CSRF_COOKIE_SECURE = True SECURE_SSL_REDIRECT = False -SECURE_HSTS_SECONDS = get_env_value('DJANGO_SECURE_HSTS_SECONDS', default=120) \ No newline at end of file +SECURE_HSTS_SECONDS = get_env_value('DJANGO_SECURE_HSTS_SECONDS', default=120)