MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
MEDIA_URL = '/media/'
from django.urls import path, include, re_path
from django.views.static import serve
from mysite import settings
urlpatterns = [
re_path(r"media/(?P<path>.*)$", serve, {'document_root': settings.MEDIA_ROOT})
]
网友评论