8

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!

3
  • 1
    I have a project dealing with the exact same peculiar behavior. Can you list your versions for Django, Docker, etc.?
    – Bryce
    Commented Feb 25, 2023 at 22:39
  • Django version 3.2.12. Docker version 4.10.1. I have tested the project on another machine and it works fine, which leads me to think it's an issue with my machine somehow rather than the project itself? Commented Feb 27, 2023 at 8:47
  • I'm having the exact same issue starting today, django 4.0.7, docker version 23.0.1.
    – tannart
    Commented Feb 27, 2023 at 11:47

1 Answer 1

7

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.

1
  • 1
    Thanks so much for this - sorted it out perfectly. Really appreciate you taking the time to post and point me in the right direction. Commented Feb 27, 2023 at 15:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.