[Django] #22729: Runserver’s autoreload not monitoring views.py & urls.py

9 views
Skip to first unread message

Django

unread,
May 29, 2014, 12:17:18 PM5/29/14
to django-...@googlegroups.com
#22729: Runserver’s autoreload not monitoring views.py & urls.py
-------------------------------+------------------------
Reporter: Nim65s | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.7-beta-2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------
Hi,

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.

Django

unread,
May 29, 2014, 12:20:40 PM5/29/14
to django-...@googlegroups.com
#22729: Runserver’s autoreload not monitoring views.py & urls.py
-------------------------------+--------------------------------------

Reporter: Nim65s | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.7-beta-2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by anonymous):

* 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>

Django

unread,
May 29, 2014, 12:40:59 PM5/29/14
to django-...@googlegroups.com
#22729: Runserver’s autoreload not monitoring views.py & urls.py
-------------------------------+--------------------------------------

Reporter: Nim65s | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.7-beta-2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

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>

Django

unread,
Jun 1, 2014, 9:13:35 AM6/1/14
to django-...@googlegroups.com
#22729: Runserver’s autoreload not monitoring views.py & urls.py
-------------------------------+--------------------------------------
Reporter: Nim65s | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.7-beta-2
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by claudep):

* 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>

Django

unread,
Jun 5, 2014, 12:04:32 AM6/5/14
to django-...@googlegroups.com
#22729: Runserver’s autoreload not monitoring views.py & urls.py
-------------------------------+--------------------------------------
Reporter: Nim65s | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.7-beta-2
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by Nim65s):

Ok, I got it, thanks !

--
Ticket URL: <https://code.djangoproject.com/ticket/22729#comment:4>

Reply all
Reply to author
Forward
0 new messages