我有一个锚标记,它命中一条在新选项卡中生成报告的路线。我正在延迟加载报告规范,因为我不想在原始位置和报告对象上拥有我的数据副本。但是收集这些数据需要 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 完成时加载报告。