需要再主url.py中设置
from django.urls import include, path from django.conf.urls.static import static from django.conf import settings urlpatterns = [ path("", include("apps.xxx.urls")), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
需要再主url.py中设置
from django.urls import include, path from django.conf.urls.static import static from django.conf import settings urlpatterns = [ path("", include("apps.xxx.urls")), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)