Answer the question
In order to leave comments, you need to log in
How to generate a link to download a file?
There is a view - which generates a file in the reports folder.
How to generate a link to download the generated file, ?
If it's just along the path: "/reports/rep.doc", then it says that the given url was not found :( (I don't understand how to form it correctly? ) :(((
Answer the question
In order to leave comments, you need to log in
Add this directory to urls.py. In the following way:
import os
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
...
]
urlpatterns += static('/reports/', document_root=os.path.join(settings.BASE_DIR, 'reports'))
perhaps a rule is written in .htaccess - do not give any files, respectively, it will be necessary to introduce an exception.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question