我正在通过Flask向用户提供报告。但是,要获取报告,我需要提供下载报告的链接。在localhost中,我传递消息
href =“ http://127.0.0.1:8080/apps/bas/download_full_report”>本地下载文件
即使应用程序部署在像openshift这样的容器平台上,我也传递相同的链接吗?
@application.route(app_route+'download_full_report')
def generate_report():
reportType = session['context_variables']['report_type']
df =pickle.loads(zlib.decompress(r.get(reportType+broker_tax_id+"full_report")))
execel_file = StringIO()
filename = "%s.csv" % ('output file')
df.to_csv(execel_file, encoding='utf-8')
csv_output = execel_file.getvalue()
execel_file.close()
resp = make_response(csv_output)
resp.headers["Content-Disposition"] = ("attachment; filename=%s" % filename)
resp.headers["Content-Type"] = "text/csv"
return resp