I have a python app built on flask, now before render_templateis called, the function that passes data values to the html takes a long time to execute. As a result, when I click http://127.0.0.1:5000/ i see a white screen for around 30secs./ 1minute before the html is displayed.Code is something like this
@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()
How do I add a preloader gif even before the render_template html is called? I have seen some answers which talk about displaying a loading gif on click of a button or something like that, but I need to display the loading gif at first load time and when the http://127.0.0.1:5000/ is refreshed using the refresh icon in toolbar. I tried some CSS/HTML tinkering but they only come into picture AFTER the render_template html is called. The program spends a bulk of its time before the render function is even called.