New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File download inside django-unicorn #486
Comments
Where is this code? Is it inside a |
Hello @adamghill, I would like to be able to provide a dynamically created file, when user clicks on a download button. To create the file, I need data that exist within the unicorn component. My stupid approach was to call an action method that returns a FileResponse (like you can return HttpResponseRedirect), but unfortunately that crashes with following exception:
If there is another possible approach, I would be thankful to get advice. Maybe I can access the UnicornView instance from the outer/wrapping django view? |
I think your inclination to return How big is the file? Is it reasonable for I think one potential workflow would be:
|
In my case it will be an Excel file with a size of 200-600KB, but I think larger files of 10MB or so should be supported too. In general the temporary directory should be Your workflow sounds sensible. Some comments that come to my mind:
Thank you for considering this for your nice project |
Hi!
I'm trying to download PDF files from the django runserver development server, "python manager.py runserver", inside a django-unicorn application, but I can't download them. Follow the code >
with open(os.path.join("c:/mydirectory/tmp", filename + '.pdf'), 'rb') as f:
data = f.read()
No error occurs, but accessing from another machine I can't download.
Is there any way to be reproduced?
Thanks!
The text was updated successfully, but these errors were encountered: