There are a few ways you can do this. I'm not sure if you're talking about user uploaded files, or files that are static-files.
Approach 1
Just link to the relevant file from a template.
For user-uploaded files
{% load static %}
<a href="{% get_media_prefix %}name_of_pdf.pdf">Click Me</a>
For static files
{% load static %}
<a href="{% static 'name_of_pdf.pdf' %}">Click Me</a>
Approach
If you are trying to return the file from a view
from django.http import FileResponse
def load_file(request):
file = ... # get file somehow
return FileResponse(file)
See django docs for futher details. If the file is from your static folder, you could just use pythons open
to read it. It depends on how you are serving your static files.
If this pdf is a user-uploaded file, attached to a model, you can access it via the appropriate field.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…