#23882: django 1.7 + inotify breaks autoreload of runserver with vim
------------------------------+--------------------
Reporter: orzel | Owner: nobody
Type: Bug | Status: new
Component: Core (Other) | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------
Quick summary : since i've migrated to django-1.7, autoreload is broken on
my systems. I've used django since 0.96 and i have never had any problem
with this great feature.
I've turned around the problem until today by removing pyinotify : that
fixed the problem for me. But of course i need pyinotify for other
things...
Today I've spent time testing more thoroughly, here are the results. My
system is fairly standard : linux, gentoo, python 2.7, and vim-7.4.488.
I patched django/utils/autoreload.py to add some debug to get more
information.
*) when pyinotify is not installed, USE_INOTIFY is indeed False and
everything is working as expected and as before.
*) when pyinotify is installed, USE_INOTIFY is True, and the file i'm
testing with (main/views/gestion.py) is indeed added to the inotify watch
list (around line 185 of autoreload.py). I need to load a page for this to
happen, but this is expected because the autoreload stuff only consider
those modules loaded by the python interpreter iiuc.
In this setup, if i use CLI and does "touch main/views/gestion.py", the
autoreload is triggered (displayed in the output of runserver).
With the same setup, if i open the file with vim and just do ":w", which
saves the file again, nothing is triggered. I tried doing an actual
modification and save (in case vim or inotify of even django optimizes the
stuff by not reloading a file whose content hasn't changed), but the
behaviour is the same.
I can confirm the file was not reloaded by changing something in the file
and testing from my browser.
I think to remember that vim doesn't just overwrite the file but instead
writes the content to a new file and then relinks the files, which might
be the reason inotify doesn't notice the change. But i can't guarantee
this.
I know of so many people using django+vim, that i'm very surprised nobody
was hit by this before, so maybe I'm not understanding something obvious
and the reason is somewhere else ..
I'm "orzel" on irc, very often available, don't hesitate to ping me (or
here) if you need some more information/test.
--
Ticket URL: <https://code.djangoproject.com/ticket/23882>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/048.6e6099a834593d37b742318a7365f8f1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.