【发布时间】:2021-08-23 00:29:39
【问题描述】:
我正在尝试使用 D jango 在我的 html 页面上显示图片,但它没有显示
它是这样显示的
我在设置中添加了这段代码
STATIC_URL = '/static/'
STATIC_ROOT = posixpath.join(*(BASE_DIR.split(os.path.sep) + ['static']))
MEDIA_URL='/media/'
MEDIA_ROOT=os.path.join(BASE_DIR, 'media')
这个在网址的末尾
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
我有html页面,我写了这样的图像代码
<img src="images/offer.jpg" alt="" />
这是我的文件
希望我能在这里找到解决方案
【问题讨论】:
标签: django visual-studio visual-studio-code django-templates visual-studio-2019