Another attempt at serving media files
This commit is contained in:
@@ -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<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}),
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||
|
||||
Reference in New Issue
Block a user