question about returning file (pdf,image,zip...) in a request that made from temporary URL
43 views
Skip to first unread message
ali Eblice
unread,
Oct 28, 2016, 10:59:53 AM10/28/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
hello think of a downloading website: when we create a temporary link in django and map it to actual URL or file path in database like this:
id -- temporary_URL -- origin_URL -- file_path
so when a user used a temporary URL and directed to some view , how should i return that file from that view for user to be able to download that file? i know that i can use "FileResponse" or "StreamingHttpResponse" but in django documentation says that we should use these for short-lived requests but downloading a big file can take long time, so what should i do ? i appreciate any help and idea
Stefano Probst
unread,
Oct 29, 2016, 10:43:00 AM10/29/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
thanks for reply i setup the x-sendfile but there's a problem :
django return a x-sendfile response successfully but since i'm using django development area and the development area runs on port 8000 the return response will be on port 8000 but the apache web server runs on port 80 so the response wont go to apache so it cause me to download the file with 0 byte size
how can i solve this problem ?
Stefano Probst
unread,
Oct 31, 2016, 9:34:09 AM10/31/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
You could use a whole deployment setup. Forward Django though nginx by using WSGI (Gnuicorn, etc). Then everything should work.