Search code examples
djangodockerdocker-composecookiecutter-django

Django "Detected change in ..., reloading" Error in Docker


I'm having a problem which I don't understand, and therefore can't resolve.

I have a Dockerised Django project, which I created using Cookiecutter Django months ago. Today, my development environment has started displaying the following error on every request:

code of error

I am not currently having this issue in production. I tried rolling back to commits that worked properly before (1 week old commits, for example), and I'm still getting this error.

The reloading is causing connections to the database to close and therefore my project isn't working properly at all.

Does anyone know what causes this, and how I might fix it? It feels like an issue with my Docker setup, but that hasn't changed in months, so I don't understand why that would change now.

Many Thanks for any help anyone can offer!


Solution

  • Solution:

    remove Werkzeug[watchdog] from your requirements and replace it with just Werkzeug, then rebuild your docker container.

    Explanation:

    There's an issue with the watchdog Werkzeug backend which is included in new cookiecutter-django projects by default. Relevant thread here: https://github.com/cookiecutter/cookiecutter-django/issues/4179.