#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 | Resolution:
Keywords: autoreload | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------
Comment (by chrisbainbridge):
The [https://code.djangoproject.com/attachment/ticket/24875/0001-Detect-
moved-file-when-using-inotify-polling.patch patch I provided in bug
#24875] fixed this issue for me. Required flags:
{{{
pyinotify.IN_CREATE | pyinotify.IN_DELETE_SELF | pyinotify.IN_MOVE_SELF
}}}
@orzel Try the following test code, run as `python test dir_to_watch` then
start vim and edit/save a file in the test directory. The notifier loop
will print whatever inotify events occur:
{{{
import sys
import pyinotify
wm = pyinotify.WatchManager()
wm.add_watch(sys.argv[1], pyinotify.ALL_EVENTS)
notifier = pyinotify.Notifier(wm)
notifier.loop()
}}}
Django does not watch the whole directory, but instead generates a list of
paths to watch based on the current python imports. This means there are
some cases where files are not initially watched - basically any python
file that is dynamically loaded at runtime, such as a view specified by a
string literal in urls.py. These files will be watched after the
corresponding web page has been loaded for the first time.
You can see the current list of paths being watched by adding a print
statement to `django/utils/autoreload.py:inotify_code_changed()`
--
Ticket URL: <https://code.djangoproject.com/ticket/23882#comment:8>
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/063.a8bd53f60f5f7d08c2ed1f6c7787c60f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.