import datetime import os from flask import Flask, send_from_directory, request from flask_cors import CORS app = Flask(__name__) CORS(app) @app.route("/download") def index(): basedir = os.path.abspath(os.path.dirname(__file__)) path = basedir + '\' + str(datetime.datetime.now().date()) file_name = request.args.get('file_name') print(file_name) print(path) return send_from_directory(path, filename=file_name + ".xlsx", as_attachment=True) if __name__ == '__main__': app.run(host='0.0.0.0', port=8002, debug=True)