【发布时间】:2016-03-09 14:41:47
【问题描述】:
我有一个锚标记,该标记命中在新选项卡中生成报告的路线。我正在延迟加载报告规范,因为我不想在原始位置和报告对象上拥有我的数据副本。但收集这些数据需要 10-20 秒。
from flask import render_template
@app.route('/report/')
@app.route('/report/<id>')
def report(id=None):
report_specs = function_that_takes_20_seconds(id)
return render_template('report.html', report_specs=report_specs)
我想知道我能做些什么,以便服务器立即用微调器响应,然后在 function_that_takes_20_seconds 完成后,加载报告。
【问题讨论】:
-
运行时间超过几秒的作业对于像 celery 这样的任务队列来说是很好的工作。
标签: python flask server-response