Fail on startup if an invalid language code is the default locale

This commit is contained in:
Raphael Michel
2024-01-03 11:10:31 +01:00
parent a8893bdc96
commit abe45bccae

View File

@@ -41,6 +41,7 @@ from json import loads
from urllib.parse import urlparse
import importlib_metadata as metadata
from django.core.exceptions import ImproperlyConfigured
from django.utils.crypto import get_random_string
from kombu import Queue
@@ -495,6 +496,11 @@ for k, v in ALL_LANGUAGES: # noqa
continue
LANGUAGES.append((k, v))
if LANGUAGE_CODE not in {l[0] for l in LANGUAGES}:
raise ImproperlyConfigured(
f"Default language {LANGUAGE_CODE} is not one of the available and enabled languages."
)
AUTH_USER_MODEL = 'pretixbase.User'
LOGIN_URL = 'control:auth.login'