From 14a6067589959ca7de7eef1009ccd1d32e896b08 Mon Sep 17 00:00:00 2001 From: moanos Date: Thu, 30 May 2024 10:58:03 +0200 Subject: [PATCH] feat: Add more informative error messages when no settings are set --- src/notfellchen/settings.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/notfellchen/settings.py b/src/notfellchen/settings.py index bdfb07f..e2b5093 100644 --- a/src/notfellchen/settings.py +++ b/src/notfellchen/settings.py @@ -24,6 +24,7 @@ if 'DOCKER_BUILD' in os.environ and os.environ.get('DOCKER_BUILD'): else: config.read(['/etc/notfellchen/notfellchen.cfg', os.path.expanduser('~/.notfellchen.cfg'), 'notfellchen.cfg'], encoding='utf-8') + CONFIG_FILE = config DJANGO_LOG_LEVEL = config.get('logging', 'django_log_level', fallback="WARNING") @@ -62,7 +63,10 @@ LOGGING = { } """ DJANGO """ -SECRET_KEY = config.get('django', 'secret') +try: + SECRET_KEY = config.get('django', 'secret') +except configparser.NoSectionError: + raise BaseException("No config found or no Django Secret is configured!") DEBUG = config.getboolean('django', 'debug', fallback=False) """ DATABASE """