简体   繁体   中英

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. name of the file is np.pdf. previously I had resume.pdf and it was working fine. 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. again i edited to np.pdf- run the server again- not showing any error again a pop up of resume.pdf's download. notes: I am new to django.

html code :

<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?

{% load static %}

<a class="nav-item nav-link" href="{% static 'np.pdf' %}">Resume</a>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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