title: Improving the user experiense of a slow Flask view
body: <p>I have an anchor tag that hits a route which generates a report in a new tab. I am lazyloading the report specs because I don't want to have copies of my data in the original place and on the report object. But collecting that data takes 10-20 seconds.</p>
  
  <pre><code>from flask import render_template
  
  @app.route('/report/')
  @app.route('/report/&lt;id&gt;')
  def report(id=None):
      report_specs = function_that_takes_20_seconds(id)
      return render_template('report.html', report_specs=report_specs)
  </code></pre>
  
  <p>I'm wondering what I can do so that the server responds immediately with a spinner and then when function_that_takes_20_seconds is done, load the report. </p>