Hot Reload not working

Hi,

I am new to Dash and started doing the tutorial Dash in 20 Minutes Tutorial | Dash for Python Documentation | Plotly.

I immediately noticed, that hot reload is not working. Specifically, when I create an app, run it, open it in my browser and then do and save changes in the app, these changes are not reflected.

Root cause for this behavior is likely, that the default method that Dash (or Flask) uses to detect File System Changes does not work on my company computer. I had the same issues when testing streamlit and Shiny (using uvicorn), but there I easily found options to change the method of detecting file system changes to “Polling”, after which they both worked fine.

After 2 hours of searching sources codes and googling, I can´t find any such option for Dash or Flask. Can anyone help?

Hello @mgg1,

Welcome to the community!

If you could, please tell us a little more about what your computer and setup are?

OS, version of dash, etc.

Hi,

I am working on a virtual machine and on network drives.

OS: Windows Server 2019.
IDE: VS Code
Dash Version: 2.13.0
Python Version: 3.10.11

I hope that helps.

What is the run command that you are using?

I use Pycharm and I run it straight from the python file.

app.run(debug=True)

I tried jupyter (app.run(jupyter_mode=“tab”, debug=True)) as well, however same issue that there is no hot reload. However, at least here the start-up takes only a few seconds. Still, not ideal.

To run from PyCharm, I run by right clicking on the app’s script and clicking run.

IDE is surely not relevant for this topic. As said, I am quite convinced it is related to how Dash / Flask serves detects changes on the the file system.

EDIT: Fixed it! “pip uninstall watchdog” forces flask to use stat reloader, which is based on Polling. There is probably an alternative way to force Flask to use Polling, but as watchdog anyway does not work for me this solution is straight forward.

1 Like

Me after digging into the problem, I suspect that the default file system change detection method used by Dash (and Flask, which Dash is built upon) might not be compatible with my company’s computer setup. I faced similar challenges when working with Streamlit and Shiny, and in those cases, I was able to resolve the issue by changing the url system change detection method to “Polling.”