By POST request I am going to let client store generated file to his local HHD by executing send_file() command. Here is the code:
def send_file_to():
try:
file_name = store_user_list()
send_file(file_name, as_attachment=True, conditional=True)
script_message = "File has been provided"
except Exception as e:
script_message = "File sending Error: " + str(e)
return render_template('result.html', result_message=script_message)
unfortunately, it doesn't store file. Only if I change the script to:
return send_file(file_name......
But I would like to get back on result.html page in any result. The command above leave me on the same page where I pressed the button "Download File".
Should I check any other event in @app to catch when download is finished?
Can you please help me understand the workflow that let me have required behaviour.