[英]why my static file is not loading in django?
I paste a pdf file in my static folder and the file is not getting loaded. 我将pdf文件粘贴到我的静态文件夹中,但该文件未加载。 name of the file is np.pdf.
文件名是np.pdf。 previously I had resume.pdf and it was working fine.
以前我有resume.pdf,并且工作正常。 but after trying np.pdf(which is not working) i edited the code to resume.pdf again but when i'm clicking the resume link- the browser opens a pdf download pop up.
但是在尝试np.pdf(不起作用)后,我再次将代码编辑为resume.pdf,但是当我单击恢复链接时,浏览器打开了一个pdf下载弹出窗口。 again i edited to np.pdf- run the server again- not showing any error again a pop up of resume.pdf's download.
再次,我编辑为np.pdf-再次运行服务器-再次没有显示任何错误,出现了resume.pdf的下载弹出窗口。 notes: I am new to django.
注意:我是django的新手。
html code : html代码 :
<a class="nav-item nav-link" href="{% static 'np.pdf' %}">Resume</a>
Do you have {% load static %}
at the very beginning of your html page? 您在HTML页面的开头是否有
{% load static %}
?
{% load static %}
<a class="nav-item nav-link" href="{% static 'np.pdf' %}">Resume</a>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.