我不确定我做错了什么,但我的图片不会显示
HTML:
{% load static %}
<img src="{% static 'images/IMG_0096.JPG' %}" alt="Mountain View"/>
settings.py:
STATIC_URL = '/static/'
STATICFILES_DIRS = ( os.path.join(BASE_DIR, "static"), )
由于
答案 0 :(得分:0)
将STATIC_ROOT
设置添加到settings.py
以查看静态文件
`STATIC_ROOT = os.path.join(BASE_DIR, "static")
如果您在开发环境中,请在urls.py
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
# ... the rest of your URLconf goes here ...
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)