📜  Flask 下载文件 - 任何代码示例

📅  最后修改于: 2022-03-11 14:59:53.103000             🧑  作者: Mango

代码示例2
from flask import Flask
from flask import send_file
app = Flask(__name__)

@app.route('/download')
def downloadFile ():
    #For windows you need to use drive name [ex: F:/Example.pdf]
    path = "/Examples.pdf"
    return send_file(path, as_attachment=True)

if __name__ == '__main__':
    app.run(port=5000,debug=True)