Can someone help me in django when downloading a file. I have this code:
<a href="#">Download</a>
I have a pdf file in my static folder and once I click it, the pdf file will be downloaded.
Can you help me with this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
<a href="{{ MEDIA_URL }}/pdf/yourPDFfilename.pdf">Download</a>If I understand the question, this should work.
MEDIA_URLis set in your projectsettings.pyfile and will aliases to the value you set inMEDIA_ROOT.