equinor / webviz-config

Make Dash applications from a user-friendly config file :book: :snake:
https://github.com/orgs/equinor/projects/24
MIT License
54 stars 39 forks source link

Hot reload not working #38

Closed anders-kiaer closed 5 years ago

anders-kiaer commented 5 years ago

If debug in the flask server is not set to True, it looks like hot reloading of the dash application is not working. According to dash documentation, there is a flag dev_tools_hot_reload which can be set to True to enable hot reloading (without enabling the whole suite of debug tools).

Here is the line in the template setting debug/dev_tools_hot_reload and here is the dash documentation on the dev tools.

anders-kiaer commented 5 years ago

Looks like the solution is to not to use dash in this case, but rather directly going to the attached flask server.

According to the flask docs this will avoid full debug mode, but still activate reload: app.run_server([...], debug=False, use_reloader=True)

The documentation also states that the run() command on a flask server, together with reload, is not well supported. Instead the docs suggest using the command line client, e.g. something like:

FLASK_APP=webviz_app:server
flask run --no-debugger --reload

Wrt. automatic browser refresh (not only reload of app on server), some experiences here: https://stackoverflow.com/questions/51379705/flask-auto-reload-does-not-refresh-browser https://github.com/lepture/python-livereload#flask