From 6af28e6fe57abdceeb5adb0cdf8e0549507a1bfe Mon Sep 17 00:00:00 2001 From: smilerz Date: Tue, 28 Nov 2023 11:47:23 -0600 Subject: [PATCH] alpine uses TZ to set OS timezone, to stay consistent changed TIMEZONE env variable to TZ added deprecated warning to TIMEZONE --- .env.template | 2 +- recipes/settings.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.env.template b/.env.template index c1ba71f7..3556d34c 100644 --- a/.env.template +++ b/.env.template @@ -28,7 +28,7 @@ SECRET_KEY_FILE= # --------------------------------------------------------------- # your default timezone See https://timezonedb.com/time-zones for a list of timezones -TIMEZONE=Europe/Berlin +TZ=Europe/Berlin # add only a database password if you want to run with the default postgres, otherwise change settings accordingly DB_ENGINE=django.db.backends.postgresql diff --git a/recipes/settings.py b/recipes/settings.py index df2c2b1d..42164766 100644 --- a/recipes/settings.py +++ b/recipes/settings.py @@ -450,7 +450,11 @@ for p in PLUGINS: LANGUAGE_CODE = 'en' -TIME_ZONE = os.getenv('TIMEZONE') if os.getenv('TIMEZONE') else 'Europe/Berlin' +if os.getenv('TIMEZONE') is not None: + print('DEPRECATION WARNING: Environment var "TIMEZONE" is deprecated. Please use "TZ" instead.') + TIME_ZONE = bool(int(os.getenv('REVERSE_PROXY_AUTH', False))) +else: + TIME_ZONE = os.getenv('TZ') if os.getenv('TZ') else 'Europe/Berlin' USE_I18N = True