diff options
| -rw-r--r-- | django/views/debug.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/django/views/debug.py b/django/views/debug.py index a396d36244..fa18dfa7ac 100644 --- a/django/views/debug.py +++ b/django/views/debug.py @@ -2,6 +2,7 @@ import datetime import os import re import sys +import types from django.conf import settings from django.http import HttpResponse, HttpResponseServerError, HttpResponseNotFound @@ -275,8 +276,13 @@ def technical_404_response(request, exception): # tried exists but is an empty list. The URLconf must've been empty. return empty_urlconf(request) + urlconf = getattr(request, 'urlconf', settings.ROOT_URLCONF) + if isinstance(urlconf, types.ModuleType): + urlconf = urlconf.__name__ + t = Template(TECHNICAL_404_TEMPLATE, name='Technical 404 template') c = Context({ + 'urlconf': urlconf, 'root_urlconf': settings.ROOT_URLCONF, 'request_path': request.path_info[1:], # Trim leading slash 'urlpatterns': tried, @@ -773,7 +779,7 @@ TECHNICAL_404_TEMPLATE = """ <div id="info"> {% if urlpatterns %} <p> - Using the URLconf defined in <code>{{ settings.ROOT_URLCONF }}</code>, + Using the URLconf defined in <code>{{ urlconf }}</code>, Django tried these URL patterns, in this order: </p> <ol> |
