feat: Add more informative error messages when no settings are set

This commit is contained in:
moanos [he/him] 2024-05-30 10:58:03 +02:00
parent 24c2fbfddf
commit 14a6067589

View File

@ -24,6 +24,7 @@ if 'DOCKER_BUILD' in os.environ and os.environ.get('DOCKER_BUILD'):
else: else:
config.read(['/etc/notfellchen/notfellchen.cfg', os.path.expanduser('~/.notfellchen.cfg'), 'notfellchen.cfg'], config.read(['/etc/notfellchen/notfellchen.cfg', os.path.expanduser('~/.notfellchen.cfg'), 'notfellchen.cfg'],
encoding='utf-8') encoding='utf-8')
CONFIG_FILE = config CONFIG_FILE = config
DJANGO_LOG_LEVEL = config.get('logging', 'django_log_level', fallback="WARNING") DJANGO_LOG_LEVEL = config.get('logging', 'django_log_level', fallback="WARNING")
@ -62,7 +63,10 @@ LOGGING = {
} }
""" DJANGO """ """ DJANGO """
try:
SECRET_KEY = config.get('django', 'secret') 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) DEBUG = config.getboolean('django', 'debug', fallback=False)
""" DATABASE """ """ DATABASE """