django still uses StatReloader even though watchman & pywatchman are installed

492 Views Asked by At

I wanted to slow down the auto-reload feature of django's runserver for 7 seconds. While searching for a solution, I read on the django documentation https://docs.djangoproject.com/en/4.1/ref/django-admin/#s-runserver that I should install Watchman as well as pywatchman and that django will use that instead for which I can add a timeout period for reload after file change. I also read on https://adamj.eu/tech/2021/01/20/efficient-reloading-in-djangos-runserver-with-watchman/ that after installation django's runserver will show Watching for file changes with WatchmanReloader instead of Watching for file changes with StatReloader.

I also add a .watchmanconfig like this:

{"ignore_dirs": [".git", ".vscode", "venv", "htmlcov", "media", ]}

But on mine it still uses StatReloader even though watchman & pywatchman are installed in accordance with their doc.

django version: 4.1.2
python version: 3.8.16
watchman version: 20221225.010033.0
pywatchman version: 1.4.1

Can anybody help?

My gratitude before hand

1

There are 1 best solutions below

0
On

I believe it's an issue with pywatchman (see: https://github.com/facebook/watchman/issues/970).

You can consider downloading watchfiles and django-watchfiles as suggested here: https://github.com/facebook/watchman/issues/970#issuecomment-1191330203.