Black Lives Matter. Please consider donating to Black Girls Code today.

How to set set up a site with auto reload

I’m checking out Dash and it looks great. :smile:

However, to speed up the visual dev cycle I’d love to use auto reload in the site generated by the Python app. This means: When I re-run the app after layout changes the browser displaying the site automatically reloads the page.

Is there a way to integrate for example browsersync in a Dash app? Any tutorial for this?

See 📣 Announcing Hot reload

Thanks, Chris. Will try it out.

I tried it - and it does the reload/restart of the server app. However I’m looking for a reload in the browser like browsersync.

This means when the server app restarts the brwoser detects teh change to the html/javascript files and realoads as well.

Has any body done this? Maybe by integrating the browsersync javascript code into Dash?

Are you looking for https://dash.plot.ly/live-updates perhaps?

Thx Chrisfor your prompt response. Looks quite complicated though for just a developer convinience… Might just continue to hit Ctrl-R. :wink:

On static sites browsersync is quite easy to wire up with a node development server, so that was worthwhile doing…

It really does sound like you are looking for hot-reloading. hot-reloading restarts the server but it also refreshes the browser once the server is restarted. This is the default mode in the latest version of dash (https://dash.plot.ly/installation)

It works now including the browser reload - but I could swear it did not work before… Not sure what I did wrong earlier… Maybe i didn’t set debug-True, or I just didn’t wait long enough for the changes to propagate.

Anyway, it works now. Thanks a lot for your continues responding!

1 Like