Go Set Up Watchman

The built-in Django server greatly facilitates development by reloading Python code when it detects file changes. As of Django 2.2, the server has started to watch for changes in a different way. As the release notes point out:

runserver can now use Watchman to improve the performance of watching a large number of files for changes.

For a project that I am working on, using Watchman turned out to be more of a requirement than a bonus. Without watchman it could take minutes for the server to reload a changed file.

Part of the blame certainly lay with a large and growing node_modules directory. If this might be you, then you’ll definitely want to heed the advice from the Django docs on the runserver to install pywatchman (available through pip) and Watchman for your operating system. You’ll also want to add a .watchmanconfig file to your project with something like the following:

        "ignore_dirs": ["node_modules"]

It made a world of difference for us.