Opened 14 years ago

Closed 14 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


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 Changed 14 years ago by rokclimb15@…

This is a fairly minor but annoying issue. To reproduce, duplicate an call in 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.

comment:2 Changed 14 years ago by anonymous

Cc: rokclimb15@… added

comment:3 Changed 14 years ago by Trevor Caira

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 accordingly (to import project.settings instead of settings), when you run ./ 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, 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 ./ shell will not work. Had the original traceback been available in the first place, the error would have been obvious.

comment:4 Changed 14 years ago by Jacob

Triage Stage: UnreviewedDesign decision needed

While this is annoying, I'm not sure if there's anything we can do about it.

comment:5 Changed 14 years ago by

Resolution: duplicate
Status: newclosed

This is a duplicate of #7524 that also has a patch.

Note: See TracTickets for help on using tickets.
Back to Top