我想从数据库中获取图像以显示在我的html页面上,但它显示的是找不到的页面404http://127.0.0.1:8000/media/designs/myphoto.jpg
def index(request):
topImgs = PortfolioImages.objects.filter(feature=2)
botImgs = PortfolioImages.objects.filter(feature=3)
return render(request, 'ideadunes/index.html', {'topImgs':topImgs, 'botImgs':botImgs})
您可以在模板中使用:
{{topImgs.url}}
将此添加到您的URL
相关问题 更多 >
编程相关推荐