简体   繁体   English

Django static 图像在设置 debug=False 时未加载

[英]Django static image not loading on setting debug=False

How do I load images in debug=False for testing purposes?如何在 debug=False 中加载图像以进行测试? Below is my code for your reference.以下是我的代码供您参考。

<img src="/static/b_icon.png" alt="Brand Icon" width="30" height="30" class="d-inline-block align-text-top">

This is wrong:这是错误的:

<img src="/static/b_icon.png" 

This is right:这是正确的:

{% load static %}

<img src="{% static 'b_icon.png' %}

Just take a moment to read carefully Managing static files, Serving static files during development docs and follow all steps.只需花点时间仔细阅读管理 static 文件、在开发文档期间提供 static 文件并遵循所有步骤。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM