Django should allow exceptions to bubble up from urlconf imports
|Reported by:||bendavis78@…||Owned by:||nobody|
|Severity:||Keywords:||ImproperlyConfigured urconf exception traceback|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Exceptions are very hard to debug when they occur during a urlconf import. In django.core.urlresolvers._get_urlconf_module(), it wraps the import line in a try/except, and throws a new ImproperlyConfigured exception if any type of Exception is encountered. This means the only information available to the developer through the django debug page is the error message of the original exception, and not the traceback information (which is equally as important as the message itself, imho). That is, the original traceback information is lost because django throws a new exception.
Because there is potentially a lot of code that gets executed during an import, I believe _get_urlconf_module() should allow the exception to bubble up. This will make urlconf import issues much easier to debug. I don't see much advantage gained from the way it does it now.