【发布时间】:2018-04-29 14:36:07
【问题描述】:
我有一个基于flask的python应用程序,现在在调用render_template之前,将数据值传递给html的函数需要很长时间才能执行。结果,当我单击http://127.0.0.1:5000/ 时,我看到一个白屏大约 30 秒。/在显示 html 之前 1 分钟。代码是这样的
@app.route('/')
<a long time taking function to pass values to the render function below
return render_template ('xxx.html',args.values...argsn.valuen)
if __name__=="__main__":
app.run()
如何在调用 render_template html 之前添加预加载器 gif?我已经看到了一些关于在单击按钮或类似内容时显示加载 gif 的答案,但我需要在第一次加载时显示加载 gif,并且当使用工具栏中的刷新图标刷新 http://127.0.0.1:5000/ 时。我尝试了一些 CSS/HTML 修补,但它们只有在调用 render_template html 之后才会出现。该程序在调用渲染函数之前花费了大部分时间。
【问题讨论】: