From 0f1f3b9560641bfffe8dde9d8f2645617f0cf0f8 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Wed, 9 Sep 2020 17:14:03 +0200 Subject: [PATCH] Do not serve static files outside of debug server --- note_kfet/urls.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/note_kfet/urls.py b/note_kfet/urls.py index 62943e4d..ae6bf3db 100644 --- a/note_kfet/urls.py +++ b/note_kfet/urls.py @@ -36,8 +36,9 @@ urlpatterns = [ path('coffee/', include('django_htcpcp_tea.urls')), ] -urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) -urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) +# During development, serve media files +if settings.DEBUG: + urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) if "cas_server" in settings.INSTALLED_APPS: