python - Is there any way of detecting an automatic reload in flask's debug mode? -


i have flask app i'd execute code on first time app run, not on automatic reloads triggered debug mode. there way of detecting when reload triggered can this?

to give example, might want open web browser every time run app sublime text, not when subsequently edit files, so:

import webbrowser if __name__ == '__main__':     webbrowser.open('http://localhost:5000')     app.run(host='localhost', port=5000, debug=true) 

what using flask-script kick off process before start server? (cribbed documentation , edited slightly):

# run_devserver.py  import webbrowser flask.ext.script import manager  myapp import app  manager = manager(app)  if __name__ == "__main__":     webbrowser.open('http://localhost:5000')     manager.run(host='localhost', port=5000, debug=true) 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -