Refactor static file settings to use configuration for STATIC_ROOT

This commit is contained in:
Edgar P. Burkhart 2025-05-08 21:03:19 +02:00
parent 0e0da7f658
commit 530e6eaf47
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227

View file

@ -22,6 +22,7 @@ if CONFIG_PATH is not None:
# Build paths inside the project like this: BASE_DIR / 'subdir'.
MEDIA_CONF = CONFIG.get("media", {})
STATIC_CONF = CONFIG.get("static", {})
BASE_DIR = Path(__file__).resolve().parent.parent
MEDIA_ROOT = Path(MEDIA_CONF.get("root", "/var/lib/nummi"))
MEDIA_URL = "media/"
@ -124,7 +125,7 @@ USE_TZ = True
# https://docs.djangoproject.com/en/4.0/howto/static-files/
STATIC_URL = "static/"
STATIC_ROOT = "/srv/nummi"
STATIC_ROOT = STATIC_CONF.get("root", "/srv/nummi")
LOGIN_URL = "login"
# Default primary key field type