Automated Hard Refresh of Dash App

So I’m running into an issue where I have an app that people are using but they keep the app open in their browser for long periods of time (possibly days).

If I update the code itself and start serving a new version of the app, the server still gets responses back from and old version of the code which is cached in the user’s browser. This causes a bunch of errors to spam the terminal on the server as there’s often bits of code pointing to other bits of code that no longer exist.

I need some sort of way to make the app check the version of the app periodically against the latest available app on the server and do a hard refresh/reload of the app if the version has updated.

I looked through some examples and found this but it doesn’t seem like it would do full reload of the whole app itself, only the layout of the cached version.

Any thoughts?

Alright, so apparently there’s an option where I can use app.run_server(debug=True) which should do what I need, but this should only be used in a development environment.

Any idea how I can get similar functionality in a production environment?

Well, looks like I need to deploy things totally differently for production and a proper server as the one that comes with flask is just meant for development.

You can use a dcc.Interval with a high value and to run only once, the interval update a dcc.Location to reload itself.