Meaningless exception when DEBUG=False and resolver.urlconf_module is None.
|Reported by:||buriy||Owned by:||buriy|
|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)
Change History (11)
comment:1 in reply to: ↑ description Changed 6 years ago by buriy
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:5 Changed 6 years ago by buriy
- Owner changed from nobody to buriy
- Status changed from new to assigned
Changed 6 years ago by buriy
comment:7 Changed 6 years ago by russellm
- Resolution set to fixed
- Status changed from assigned to closed