title: How to refresh the flask web page?
body: <p>Recently, I have a project is to implement the dynamic plotting on a web page.</p>
  
  <p>Here is my python code </p>
  
  <pre><code>from flask import Flask
  #from flask import render_template
  import matplotlib.pyplot as plt
  import io
  import base64
  
  app = Flask(__name__)
  
  @app.route('/plot')
  def build_plot():
  
      img = io.BytesIO()
  
      y = [1,2,3,4,5]
      x = [0,2,1,3,4]
      plt.plot(x,y)
      plt.savefig(img, format='png')
      img.seek(0)
  
      plot_url = base64.b64encode(img.getvalue()).decode()
  
      return '&lt;img src="data:image/png;base64,{}"&gt;'.format(plot_url)
  if __name__ == '__main__':
      app.run(debug=True, host='0.0.0.0')
  </code></pre>
  
  <p>Here is my HTML code</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt; Plot&lt;/title&gt;
          &lt;meta content='5; url=http://127.0.0.1:5000/plot' http-equiv='refresh'&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;img src="data:image/png;base64, {{ plot_url }}"&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Although I add <code>&lt;meta content='5; url=http://127.0.0.1:5000/plot' http-equiv='refresh'&gt;</code> into my HTML code, it still can not refresh automatically. </p>
  
  <p>If I want to observe the change of the plotting, I still need to refresh it manually.</p>
  
  <p>Can anyone help me to solve this problem? Thanks a lot</p>