It seems that a touch on a views.py or an urls.py does not trigger the
runserver's autoreload as it does with any other files I tested.
I dig a little to see how this should work, and in utils/autoreload.py
there is that function gen_filenames() which looks for
sys.modules.values(), so I tried that in a ./manage.py shell:
{{{
import sys
list(filter(lambda x: 'home' in x, [filename.__file__ for filename in
list(sys.modules.values()) if hasattr(filename, '__file__')]))
}}}
which should show the monitored files in my project, and it lists
settings.py, models.py, __init__.py and even some other of my scripts, but
no views.py or urls.py.
Any clue ?
--
Ticket URL: <https://code.djangoproject.com/ticket/22729>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
PS: I tried those «touch» with Python 3.4.1 - Django 1.7.0b4 and Python
2.7.6 - Django 1.6.5, with same negative results
--
Ticket URL: <https://code.djangoproject.com/ticket/22729#comment:1>
Comment (by Nim65s):
PPS: oh, ugly filter:
{{{
[filename.__file__ for filename in list(sys.modules.values()) if
hasattr(filename, '__file__') and 'home' in filename.__file__]
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/22729#comment:2>
* status: new => closed
* resolution: => invalid
Comment:
The reloading code only monitors imported files (aka sys.modules). When
you launch `runserver` and no requests have been made, `urls.py` might not
have been imported yet, so no need to reload the module after any
modification. After each request, the list of monitored files is updated,
so if you touch `urls.py` after a request has been made, you should see
the autoreloader in action. I think this is expected behavior.
--
Ticket URL: <https://code.djangoproject.com/ticket/22729#comment:3>
Comment (by Nim65s):
Ok, I got it, thanks !
--
Ticket URL: <https://code.djangoproject.com/ticket/22729#comment:4>