Opened 16 years ago
Closed 16 years ago
#7979 closed (duplicate)
django doesn't give a traceback for errors resulting from importing the root URLconf
Reported by: | Trevor Caira | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Keywords: | ||
Cc: | rokclimb15@… | Triage Stage: | Design decision needed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If the root URLconf raises an error causing django to crash, instead of displaying that traceback, django shows a traceback leading up to the __import__
statement which imports the root URLconf (and then raises ImproperlyConfigured
).
Change History (5)
comment:1 by , 16 years ago
comment:2 by , 16 years ago
Cc: | added |
---|
comment:3 by , 16 years ago
It is even more annoying when importing the module itself doesn't give a traceback.
For example, if you have your settings module in a subpackage (for example "project") and have modified manage.py
accordingly (to import project.settings
instead of settings
), when you run ./manage.py shell
, import settings
will work, even if the module subpackage isn't explicitly added to your python path. If you are running your application sans manage.py
, for example with apache, and do not add the project subpackage to your python path, import settings
will no longer work. If a module which is imported by your root URLconf calls import settings
, you will get the ImproperlyConfigured
error, and trying to debug that via ./manage.py shell
will not work. Had the original traceback been available in the first place, the error would have been obvious.
comment:4 by , 16 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
While this is annoying, I'm not sure if there's anything we can do about it.
comment:5 by , 16 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
This is a duplicate of #7524 that also has a patch.
This is a fairly minor but annoying issue. To reproduce, duplicate an admin.site.register call in admin.py. The AlreadyRegistered exception is masked by the ImproperlyConfigured. In order to see the original traceback, you have to drop into the django project shell and import the offending admin module.
I think the traceback should be made available on the exception or no exceptions should be caught and should simply be allowed to bubble up as-is.