cookiecutter-django
cookiecutter-django copied to clipboard
Django server doesn't reload after changes in app
What happened?
Hi i have used a previous version of cookiecutter-django but the last one doest reload the developent server when the files change
- Host system configuration:
- OS name and version: Mac M1
Did you use it before on the Mac M1? Did you find some clues on the web about M1 + Django + reloading? Do you use docker?
Did you use it before on the Mac M1? Did you find some clues on the web about M1 + Django + reloading? Do you use docker?
Yes i have an older version running in the same mac that reloads the server and in both i use docker
If you have an working version then you are in the position of creating a diff between the projects. My hunche is that it is related to docker, so can you post a diff of local.yml?
the diff is that in the newer version have the line platform, i tried to run with the line commented but the bug persist django: &django platform: linux/x86_64
i think that it could be wathdog but i cant find where it is configured
Watchdog is configured through werkzeug in requirements/local.txt. Is your previous project using the stat reloader?
the diff are the versions.
New: Werkzeug[watchdog]==2.0.3 # https://github.com/pallets/werkzeug watchgod==0.8.2 # https://github.com/samuelcolvin/watchgod
Old: Werkzeug==1.0.1 # https://github.com/pallets/werkzeug watchgod==0.6 # https://github.com/samuelcolvin/watchgod
in the Werkzeug the name of watchgod changes to watchdog is it correctly?
I change to the older version and it restart with stat.
it seems that the problem is with watchdog
See here how werkzeug decides which reloader is uses and here how you can override the setting in runserver_plus.
Hi all, same issue - I just today switched to apple silicon. I had a working project on my intel based mac and then after migrating to the new laptop, I spun up the containers and django was no longer seeing changes.
I think this may be talking about the same problem in this Watchdog issue
did you fixed it ?
did you fixed it ?
Not a fix but a workaround is to change runserver_plus reloader to stat rather than Watchman given Watchman isn't working. Thanks @foarsitter.
@BenjaminArmijo3 you can add the following line to your local.py settings file.
RUNSERVERPLUS_POLLER_RELOADER_TYPE = 'stat'
Unfortunately the reload is takes a bit longer to trigger than you may be used to.
For me, switching the dev container to arm64 by removing platform: linux/x86_64 from local.yml did the trick - apparently that's what prevented inotify from working on a mounted volume
switching the dev container to arm64 by removing
platform: linux/x86_64fromlocal.ymldid the trick
We just removed that option in #3957. I managed to get my hand on a M1 and test it, can confirm that it was causing the issue. Closing this.