#11957: runserver must be restarted after error in admin.py
------------------------------------------------+---------------------------
Reporter: carljm | Owner: nobody
Status: closed | Milestone:
Component: django-admin.py runserver | Version: 1.1
Resolution: duplicate | Keywords:
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
------------------------------------------------+---------------------------
Comment (by carljm):
I've done further work on this and realized that I really did conflate two
completely separate issues in filing this bug. Part A - the dev server
failing to restart (because the admin.py file that failed to import is not
in sys.modules) - is indeed a dupe of #9859 (which IMHO is a strong
candidate for wontfix; there's simply no way to fix it without ugly
hacks).
However, this bug is worse than #9859 because of part B: the confusing
"admin works but my app is missing" behavior that we have currently.
Without fixing #9859, the admin-specific behavior here can still be fixed.
That behavior is not related to the reloader at all, thus I think it would
only confuse matters to discuss it on #9859. Could we reopen this issue to
pursue that specific fix (and thus also re-categorize it as an admin bug)?
More on the admin.autodiscover() issue:
It would be sufficient in this case if admin.autodiscover() ran again so
it would pick up the (now-fixed) admin.py. Problem is that would reimport
all apps' admin.py, causing a bunch of AlreadyRegistered exceptions. In
fact, it's specifically prevented from running again by the global LOADING
flag which was introduced in r9680 to fix #8245.
It seems to me the #8245 fix was inadequate. jarrow's patch on #8245
(which simply rolls-back changes to the admin-model-registry on a failed
admin.py import) both fixes #8245 and does not cause this issue. Patch
attached to demonstrate this. For tests, the patch simply includes a
modification to the #8245 test; the current bug8245 test specifies bad
behavior, because it requires that an admin.py error will only be raised a
single time and will then mysteriously disappear until the server is
restarted. I modified the test to specify the correct behavior, which is
that a bad admin.py will raise its error on each request until it is
fixed.
--
Ticket URL: <http://code.djangoproject.com/ticket/11957#comment:2>
Django <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---