Meaningless exception when DEBUG=False and resolver.urlconf_module is None.
|Reported by:||Yuri Baburov||Owned by:||Yuri Baburov|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Because of resolver.resolve500() can now fail due to urlconf_module set to None in django/core/handlers/base.py,
sometimes site developer doesn't get appropriate error message.
Instead developer gets message that handler500 is not found in urlconf module.
Problem is only in handler500 lookup, everything else goes well.
How to reproduce:
set DEBUG to False, comment out ROOT_URLCONF line.
I managed to find this problem it another way, but it will take some time to figure out how settings.py can be imported without errors, but get empty dir to LazySettings.
My suggested fix:
def handle_uncaught_exception(self, request, resolver, exc_info): ... mail_admins(subject, message, fail_silently=True) # Return an HttpResponse that displays a friendly error message. if resolver.urlconf_module is None: # FIX LINE1: you aren't getting http500! raise exc_info, None, exc_info # FIX LINE2: so we'll raise it raw. callback, param_dict = resolver.resolve500() return callback(request, **param_dict)