From 8212a2b32f8764e3713599ad71dea6e18b795031 Mon Sep 17 00:00:00 2001 From: xgdyp Date: Fri, 9 Jul 2021 21:52:28 +0800 Subject: [PATCH] change to flask 2.0 --- be/.gitignore | 1 + be/app/api/v1/files.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/be/.gitignore b/be/.gitignore index a4c5ca8..b01e363 100644 --- a/be/.gitignore +++ b/be/.gitignore @@ -6,3 +6,4 @@ __pycache__ /app/projects/* +!/app/projects/test/ \ No newline at end of file diff --git a/be/app/api/v1/files.py b/be/app/api/v1/files.py index 0de7088..af9940c 100644 --- a/be/app/api/v1/files.py +++ b/be/app/api/v1/files.py @@ -98,7 +98,7 @@ def get_json(): # 本线默认目录时app下,所以不需要再加/app了,所以不能用PROJECT_PATH # 2.创建response对象返回数据 #使用response可以将result.json再删除掉 - response = make_response(send_from_directory('', filename=DOWNLOAD_FILE_LOCATION.format(project_name), + response = make_response(send_from_directory(directory='', path=DOWNLOAD_FILE_LOCATION.format(project_name), as_attachment=True)) response.headers["Content-disposition"] = 'attachment; filename={}_result.json'.format(project_name) # print(PROJECT_PATH.format(project_name)+'/result.json')