if settings.DEBUG:
- from django.views.static import serve
- urlpatterns += [
- path('media/<path>', serve, {
- 'document_root': settings.MEDIA_ROOT,
- }),
- ]
+ from django.conf.urls.static import static
+ urlpatterns += static(
+ settings.MEDIA_URL,
+ document_root=settings.MEDIA_ROOT
+ )