title: How to automate browser refresh when developing an Flask app with Python?
body: <p>I've started learning Flask to develop web applications. What I am realy missing is an automatic Browser refresh after <strong>any</strong> code change (including static files, templates, etc.). This seems to be a standard feature in almost any Javascript framework. Frontend people have several terms for that: auto reload / refresh, hot reload / refresh (hotreload), live reload / refresh (livereload), ...</p>
  
  <p>Here on Stackoverflow most similar questions are related to the auto-reload of the Flask server (--> <a href="https://stackoverflow.com/search?q=flask+auto+reload">https://stackoverflow.com/search?q=flask+auto+reload</a>).</p>
  
  <p><strong>J just want a simple browser refresh.</strong></p>
  
  <p>I googled and tried several things - with no luck:</p>
  
  <ul>
  <li><a href="https://github.com/lepture/python-livereload" rel="noreferrer">https://github.com/lepture/python-livereload</a></li>
  <li><a href="https://gist.github.com/amontalenti/8922609" rel="noreferrer">https://gist.github.com/amontalenti/8922609</a></li>
  </ul>
  
  <p>How can I have a smooth developing experience with Flask without having to hit the F5 key 1000 times a day in a browser just to see the results of my changes?</p>
  
  <p>I think the answer is somewhere near to <code>python-livereload</code> from the link above.
  So I guess an alternative title of my question could be:</p>
  
  <blockquote>
    <p><strong>Does somebody have a working example of Flask + python-livereload?</strong></p>
  </blockquote>
  
  <p>I am to dumb to get it from their documentation :)</p>
  
  <p>EDIT: for the sake of completenes here is the Flask app I am using.</p>
  
  <pre><code># filename: main.py
  
  from flask import Flask, render_template
  from livereload import Server
  
  
  
  app = Flask(__name__)
  
  @app.route('/')
  def index():
      return "INDEX"
  
  @app.route('/bart')
  def use_jinja():
      return render_template('basic.html')
  
  
  
  if __name__ == '__main__':
      server = Server(app.wsgi_app)
      server.serve(port=5555)
  </code></pre>
  
  <p>I start the app with</p>
  
  <pre><code>python main.py
  </code></pre>