当前位置:网站首页>flask返回文件下载
flask返回文件下载
2022-07-06 07:48:00 【nongcunqq】
from flask import Flask, send_from_directory
import os
app = Flask(__name__)
@app.route("/download")
def index():
print(os.getcwd())
filename = "1.png"
path = os.path.join(os.getcwd(), filename)
return send_from_directory(path=path, directory=os.getcwd(), filename=filename,as_attachment=True)
# return send_from_directory(path='./upload/upload_cnews.xlsx', directory='./upload', filename='upload_cnews.xlsx',
# as_attachment=True)
参考
https://blog.csdn.net/qq_37754830/article/details/118884561
边栏推荐
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
- 49. Sound card driven article collection
- shu mei pai
- TS 体操 &(交叉运算) 和 接口的继承的区别
- 实现精细化生产, MES、APS、ERP必不可少
- Related operations of Excel
- Codeforces Global Round 19(A~D)
- Le chemin du navigateur Edge obtient
- octomap averageNodeColor函数说明
- onie支持pice硬盘
猜你喜欢
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Ble of Jerry [chapter]
Codeforces Global Round 19(A~D)
Pre knowledge reserve of TS type gymnastics to become an excellent TS gymnastics master
Interview Reply of Zhuhai Jinshan
Mex related learning
TS 类型体操 之 循环中的键值判断,as 关键字使用
[count] [combined number] value series
[cf gym101196-i] waif until dark network maximum flow
If Jerry needs to send a large package, he needs to modify the MTU on the mobile terminal [article]
随机推荐
成为优秀的TS体操高手 之 TS 类型体操前置知识储备
Methods for JS object to obtain attributes (. And [] methods)
Google可能在春节后回归中国市场。
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Mex related learning
Typescript void base type
Is the super browser a fingerprint browser? How to choose a good super browser?
Interview Reply of Zhuhai Jinshan
Risk planning and identification of Oracle project management system
TS 类型体操 之 extends,Equal,Alike 使用场景和实现对比
数据治理:微服务架构下的数据治理
If Jerry's Bluetooth device wants to send data to the mobile phone, the mobile phone needs to open the notify channel first [article]
datax自检报错 /datax/plugin/reader/._drdsreader/plugin.json]不存在
C # connect to SQLite database to read content
MES, APS and ERP are essential to realize fine production
Games101 Lesson 7 shading 1 Notes
上线APS系统,破除物料采购计划与生产实际脱钩的难题
Fundamentals of C language 9: Functions
Ble of Jerry [chapter]
Wonderful use of TS type gymnastics string