serve 静态文件处理

root
abc abc
  • 28 Sep

from django.conf import settings
from django.urls import re_path
from django.views.static import serve

... the rest of your URLconf goes here ...

if settings.DEBUG:
urlpatterns += [
re_path(
r"^media/(?P<path>.*)$",
serve,
{
"document_root": settings.MEDIA_ROOT,
},
),
]