Make runserver watch for extra files

Hello,

I’d like to know if there is a way to make runserver restart when other files than the source code are modified? For instance, with gunicorn, I can use the --reload-extra-file=other_file.txt option in addition to --reload to make it restart when other_file.txt changes. I don’t see a similar option for runserver. Is there another way to do it?

I saw here that I can hook into the autoreload_started signal. I managed to adapt the proposed code to make it work but this signal doesn’t seem documented, so it may not be the best way to achieve this.

You may get some ideas from Efficient Reloading in Django’s Runserver With Watchman - Adam Johnson and the associated watchman docs.

Thanks for the link! However, according the the article it cannot work on Python 3.10 and watchman sounds like a pain to install on linux since apparently they don’t provide the RPM or deb any more. The package don’t see to be included in my distro and I don’t want to install this manually.