Skip to content
Advertisement

Django download a file

I’m quite new to using Django and I am trying to develop a website where the user is able to upload a number of excel files, these files are then stored in a media folder Webproject/project/media.

JavaScript

The document is then displayed in a list along with any other document they have uploaded, which you can click into and it will displays basic info about them and the name of the excelfile they have uploaded. From here I want to be able to download the same excel file again using the link:

JavaScript

My urls are

JavaScript

but I get the error, serve() got an unexpected keyword argument ‘document root’. can anyone explain how to fix this?

OR

Explain how I can get the uploaded files to to be selected and served using

JavaScript

Advertisement

Answer

You missed underscore in argument document_root. But it’s bad idea to use serve in production. Use something like this instead:

JavaScript
Advertisement