[Flask] Serving a file to downalod AND print message on screen

Kumar, Abhinav AKumar at intrexon.com
Wed Nov 15 12:47:19 EST 2017


Hi,

After I process some data, I want to write log output to the screen and let user download the results as a zip file.

I tried flash, but that does not print message until the app is executed next time.

I can't possible use two return statements (one for send_file for download and other for rendering a template).

I could use only template rendering and provide a link to download the results file in the template html file, but that link says 'file not found'...

In my template file I have code like
    Please download the result  <a href=/upload/results.zip>here</a>
And I place the results.zip file in "upload" folder before calling render_template.

But the app says "The requested URL was not found on the server"
The URL it points to is "http://akumar-linux2:5000/upload/results.zip"

Thanks,
Abhinav


________________________________

CONFIDENTIAL TRANSMISSION - To the extent this electronic communication or any of its attachments contain information that is not in the public domain, such information is considered by Intrexon Corporation to be confidential and proprietary. This communication is expected to be read and/or used only by the individual(s) for whom it is intended. If you have received this electronic communication in error, please reply to the sender advising of the error in transmission and delete the original message and any accompanying documents from your system immediately, without copying, reviewing or otherwise using them for any purpose. Thank you for your cooperation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20171115/782577c0/attachment.html>


More information about the Flask mailing list