【发布时间】:2020-11-09 01:23:32
【问题描述】:
我正在学习 django。它在我的项目开始时工作,但现在来自静态的 imgs 只是不出现。
我尝试运行collecstatic、使用STATIC_ROOT、其他图像等等。
Settings.py
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')
]
MEDIA_URL = '/upload/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'upload')
Home.html
{% load static %}
<img scr="{% static 'img/cart-icon.png' %}">
【问题讨论】: