Home > Enterprise >  How to download file using django as backend and nginx
How to download file using django as backend and nginx

Time:08-30

I have a filefield in a document model from which i can upload files like this

document=models.FileField(max_length=350 ,validators=[FileExtensionValidator(extensions)])

uploading is working good, now i want to implement download feature for the frontend, but only those files which are uploaded by the user.

using url method is think less secure,

another way i saw is creating download function in the views,

and another i saw using nginx i can implement.

Kindly guide me which method is best, and what steps to take to implement the download feature, and will i need docker too if i am using nginx?

CodePudding user response:

i have found another way, there is a library which makes everything alot easier named as django_downloadview.

Here is the link to library https://pypi.org/project/django-downloadview/ and here is the link to documentations https://django-downloadview.readthedocs.io/en/latest/

It solved the problem for me now for creating a download link with an id to download file from storage lets see what happens in the future.

  • Related