diff --git a/VorgabenUI/urls.py b/VorgabenUI/urls.py index 963eac9..8454fab 100644 --- a/VorgabenUI/urls.py +++ b/VorgabenUI/urls.py @@ -41,7 +41,12 @@ urlpatterns = [ ] # Serve media files (including cached diagrams) -urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) +# django.conf.urls.static.static() is a no-op when DEBUG=False, +# so we wire up the serve view directly for media files. +from django.views.static import serve +urlpatterns += [ + re_path(r'^media/(?P.*)$', serve, {'document_root': settings.MEDIA_ROOT}), +] if settings.DEBUG: urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)