Flask send_file is sending old file instead of newest
send_file
has a caching timeout that you are not configuring. It will send the same file that has been cached unless you tell it not to cache the file like so:
send_file('./tmp/{}'.format(basename), as_attachment=True, cache_timeout=0)
See the following references for more information:
http://flask.pocoo.org/docs/1.0/api/#flask.send_file
http://flask.pocoo.org/docs/1.0/api/#flask.Flask.get_send_file_max_age
http://flask.pocoo.org/docs/1.0/config/#SEND_FILE_MAX_AGE_DEFAULT