Django模板图像将不会加载 [英] Django template image won't load

查看:118
本文介绍了Django模板图像将不会加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

图像不会加载。我看到破碎的图像图标。我使用静态标签。我也尝试给绝对路径,从来没有working.I使用ALT标记,但我仍然只能看到破碎的图像图标。图片在static \images\logo.png

Image won't load. I see o broken image icon. I use the static tag. I also tried giving the absolute path and never worked.I used the alt tag but still i can only see the broken image icon. Is the tag correct what else should i try.The images is in static\images\logo.png

{% load static %} {# loads static tag #}

.
.

 <div id="header">
   {% block header %}
     <img src="{% static "images/logo.png" %} alt="alternative text"  />
   {% endblock %}
</div>


推荐答案

{% load static %} {# loads static tag #}

至此:

to this:

{% load static from staticfiles %}

这篇关于Django模板图像将不会加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆