Statif media files now served in non-DEBUG-context
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/labhelper) (push) Successful in 15s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/labhelper-data-loader) (push) Successful in 3s

This commit is contained in:
2026-01-16 13:41:52 +01:00
parent 887247028a
commit 2705f6c16e
3 changed files with 14 additions and 3 deletions

View File

@@ -18,4 +18,4 @@ data:
LOGIN_REDIRECT_URL: "index"
LOGOUT_REDIRECT_URL: "login"
GUNICORN_OPTS: "--access-logfile -"
IMAGE_TAG: "0.062"
IMAGE_TAG: "0.063"

View File

@@ -27,7 +27,7 @@ spec:
mountPath: /data
containers:
- name: web
image: git.baumann.gr/adebaumann/labhelper:0.062
image: git.baumann.gr/adebaumann/labhelper:0.063
imagePullPolicy: Always
ports:
- containerPort: 8000

View File

@@ -63,5 +63,16 @@ urlpatterns = [
]
# Static files are served by WhiteNoise middleware in production
# Media files still need Django serving in all environments
# Media files need to be served in all environments
from django.views.static import serve
from django.urls import re_path
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
# Add explicit media serving for production
if not settings.DEBUG:
urlpatterns += [
re_path(r'^media/(?P<path>.*)$', serve, {
'document_root': settings.MEDIA_ROOT,
}),
]