当前位置:网站首页>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
边栏推荐
- Jerry's ad series MIDI function description [chapter]
- 解决方案:智慧工地智能巡检方案视频监控系统
- Database addition, deletion, modification and query
- 软件开发的一点随记
- Force buckle day31
- 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
- CF1036C Classy Numbers 题解
- Data governance: misunderstanding sorting
- js对象获取属性的方法(.和[]方式)
- [MySQL learning notes 29] trigger
猜你喜欢
Fundamentals of C language 9: Functions
Comparison of usage scenarios and implementations of extensions, equal, and like in TS type Gymnastics
When the Jericho development board is powered on, you can open the NRF app with your mobile phone [article]
[nonlinear control theory]9_ A series of lectures on nonlinear control theory
Ali's redis interview question is too difficult, isn't it? I was pressed on the ground and rubbed
Typescript interface and the use of generics
Pangolin Library: control panel, control components, shortcut key settings
Simulation of holographic interferogram and phase reconstruction of Fourier transform based on MATLAB
[cf gym101196-i] waif until dark network maximum flow
esRally国内安装使用避坑指南-全网最新
随机推荐
WebRTC系列-H.264预估码率计算
Interview Reply of Zhuhai Jinshan
After the hot update of uniapp, "mismatched versions may cause application exceptions" causes and Solutions
Is the super browser a fingerprint browser? How to choose a good super browser?
edge瀏覽器 路徑獲得
Typescript indexable type
The difference between TS Gymnastics (cross operation) and interface inheritance
Google may return to the Chinese market after the Spring Festival.
Luogu p4127 [ahoi2009] similar distribution problem solution
DataX self check error /datax/plugin/reader/_ drdsreader/plugin. Json] does not exist
Description of octomap averagenodecolor function
Comparison of usage scenarios and implementations of extensions, equal, and like in TS type Gymnastics
Typescript variable scope
[MySQL learning notes 30] lock (non tutorial)
Helm install Minio
珠海金山面试复盘
Ble of Jerry [chapter]
edge浏览器 路径获得
[nonlinear control theory]9_ A series of lectures on nonlinear control theory
Inspiration from the recruitment of bioinformatics analysts in the Department of laboratory medicine, Zhujiang Hospital, Southern Medical University