【发布时间】:2020-09-26 20:13:04
【问题描述】:
Django 没有加载我的静态文件。我正在尝试从静态文件夹加载图像,但它不起作用。
file.html
<body>
{% load static %}
<img src="{% static "products/logo.jpg" %}" alt="My image">
</body>
结构
app
|_______products
|_________templates
|_________file.html
|_________models.py
|_________ ...
|______static
|_________products
|_________logo.jpg
设置
...
INSTALLED_APPS = [
...
'django.contrib.staticfiles',
...
]
...
STATIC_URL = '/static/'
【问题讨论】:
-
这能回答你的问题吗? Django Static files 404
标签: django