标签:return xlsx ret ase flask date() base path str
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)
标签:return xlsx ret ase flask date() base path str
原文地址:https://www.cnblogs.com/itBlogToYpl/p/13234767.html