#32534 closed New feature (wontfix)
Allow using StatReloader even if watchman is available
Reported by: | Evgeny Arshinov | Owned by: | nobody |
---|---|---|---|
Component: | Utilities | Version: | dev |
Severity: | Normal | Keywords: | reload |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hi,
Currently if Django discovers a compatible version of watchman
, it unconditionally used WatchmanReloader instead of StatReloader. There is reason to do that because normally WatchmanReloader performs just as reliably as StatReloader while being more efficient. However, in my setup, which is WSL 2 + Docker with project dir mounted from Windows filesystem, watchman simply doesn't work because of non-functioning inotify. This lack of inotify support on WSL's part isn't clearly documented, but there are two issues WSL project members usually reference:
WSL people strongly recommend placing files to be mounted into Docker on the WSL filesystem (rather than Windows filesystem), but I have to keep them in Windows filesystem due to other issues in my development infrastructure. Not all of our development team members have to do that, so I can't exclude watchman from our development Docker image altogether which would ruin the autoreload experience for others.
What I suggest is an environment variable like DJANGO_WATCHMAN_ENABLE(D)
/ DJANGO_WATCHMAN_DISABLE(D)
which would allow me to turn off watchman support without altering the Docker image.
References:
- Watchman support in django.utils.autoreload: https://code.djangoproject.com/ticket/27685
- DJANGO_WATCHMAN_TIMEOUT - an existing watchman configuration option to be defined as an env var
Change History (4)
comment:1 by , 4 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
follow-up: 3 comment:2 by , 4 years ago
I would like to share Docker image with my colleagues. Having a dedicated image would bring me a lot of pain because Dockerfiles have almost no support for composition and overriding.
I agree that this issue is niche, but fixing it would only cost ≈2 lines of code on Django's side (+ some documentation and tests, of course). I am ready to submit a pull request and work on it if it helps. It would still be easier than having my own Docker image or hacking Django reload in some way.
comment:3 by , 4 years ago
Replying to Evgeny Arshinov:
I agree that this issue is niche, but fixing it would only cost ≈2 lines of code on Django's side (+ some documentation and tests, of course). I am ready to submit a pull request and work on it if it helps. It would still be easier than having my own Docker image or hacking Django reload in some way.
I'm sorry but we cannot add features for every users just because they are not complex ("death by a thousand cuts"). It's not clear for me why you cannot use a different virtual environment on the same docker image. You can try to use one of support channels.
Thanks for the suggestion, however it's really niche. Also, both
Watchman
andpywatchman
is required so you should be able to provide an virtual environment on your docker image withoutpywatchman
installed. I don't think there is any workaround needed in Django itself.