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

Geert Stappers stappers at stappers.nl
Thu Nov 16 15:16:10 EST 2017


On Wed, Nov 15, 2017 at 05:47:19PM +0000, Kumar, Abhinav wrote:
> 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"
> 

FWIW   I read above _two_ problems:
 * URL not found
 * wanting to write to screen


Advice: Start with fixing the "URL not found".





Groeten
Geert Stappers
Seen both postings from original poster, replying on one.
-- 
Leven en laten leven


More information about the Flask mailing list