Fix settings for templates & static files

This commit is contained in:
Tobias Kunze 2025-03-16 15:29:44 +01:00
parent e20d8cb1d5
commit 928bd06e3d

View file

@ -94,6 +94,7 @@ INSTALLED_APPS = [
"django.contrib.messages", "django.contrib.messages",
"django.contrib.staticfiles", "django.contrib.staticfiles",
"servala.core", "servala.core",
"servala.frontend",
] ]
MIDDLEWARE = [ MIDDLEWARE = [
@ -117,12 +118,19 @@ STATICFILES_FINDERS = (
"django.contrib.staticfiles.finders.FileSystemFinder", "django.contrib.staticfiles.finders.FileSystemFinder",
"django.contrib.staticfiles.finders.AppDirectoriesFinder", "django.contrib.staticfiles.finders.AppDirectoriesFinder",
) )
STATICFILES_DIRS = [BASE_DIR / "servala" / "static"]
template_loaders = (
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
)
if not DEBUG:
template_loaders = (("django.template.loaders.cached.Loader", template_loaders),)
TEMPLATES = [ TEMPLATES = [
{ {
"BACKEND": "django.template.backends.django.DjangoTemplates", "BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [], "DIRS": [],
"APP_DIRS": True, "APP_DIRS": False,
"OPTIONS": { "OPTIONS": {
"context_processors": [ "context_processors": [
"django.template.context_processors.request", "django.template.context_processors.request",
@ -130,6 +138,7 @@ TEMPLATES = [
"django.contrib.messages.context_processors.messages", "django.contrib.messages.context_processors.messages",
"django.template.context_processors.static", "django.template.context_processors.static",
], ],
"loaders": template_loaders,
}, },
}, },
] ]