Skip to content Skip to sidebar Skip to footer

My Function Containing Send_file() Does Not Seem To Update

I am using a Flask application to update some PDF files, convert them to an Excel file and send this file back to the user. I am using an instance folder to store the pdf and the e

Solution 1:

send_file takes a cache_timeout parameter which is the number of seconds you want to cache the download. By default is 12 hours.

return send_file(
    file.file_path(),
    as_attachment=True,
    cache_timeout=app.config['FILE_DOWNLOAD_CACHE_TIMEOUT'],
    attachment_filename=file.file_name
)

http://flask.pocoo.org/docs/1.0/api/


Post a Comment for "My Function Containing Send_file() Does Not Seem To Update"