django配置根下upload里面的图片显示
from django.urls import path,include,re_pathfrom auction.settings import MEDIA_ROOTfrom django.views.static import serve
urlpatterns = [ re_path(r‘^upload/(?P<path>.*)$‘, serve, {‘document_root‘: MEDIA_ROOT}),]html里面直接:
<img src="/upload/good/{{ item.images }}" alt="{{ item.title }}">