Hassn Irshaad Hassn Irshaad - 1 month ago 6
HTML Question

How to make a pdf link in Django

I'm extremely new to Django and I was hoping someone could help me add a link to my website which allows someone to download a pdf file. The pdf file is located here:

static/files/offline_reg_form.pdf


and I have no idea what the URL should be in the urls.py file or the view in the views.py file. I have looked around but nothing is working as I want it too.

Any help would be great, thanks!

Art Art
Answer

This will answer your questions.

https://docs.djangoproject.com/en/1.10/howto/static-files/

If it still confuses you, {% load static %} <img src="{% static "my_app/example.jpg" %}" alt="My image"/> is an example of what should be in your template.