Ticket #7269: debug.py.4.diff
File debug.py.4.diff, 1.9 KB (added by , 16 years ago) |
---|
-
django/views/debug.py
251 251 # tried exists but is an empty list. The URLconf must've been empty. 252 252 return empty_urlconf(request) 253 253 254 # make a URL that might be useful to the developer 255 # remove whitespace and typical regex 256 urlpatterns = [(t,t.strip('^$').replace(' ','')) for t in tried] 257 254 258 t = Template(TECHNICAL_404_TEMPLATE, name='Technical 404 template') 255 259 c = Context({ 256 260 'root_urlconf': settings.ROOT_URLCONF, 257 261 'request_path': request.path_info[1:], # Trim leading slash 258 'urlpatterns': tried,262 'urlpatterns': urlpatterns, 259 263 'reason': smart_str(exception, errors='replace'), 260 264 'request': request, 261 265 'request_protocol': request.is_secure() and "https" or "http", … … 728 732 Django tried these URL patterns, in this order: 729 733 </p> 730 734 <ol> 731 {% for pattern in urlpatterns %}732 <li>{{ pattern }}</li>735 {% for pattern,guess in urlpatterns %} 736 <li><a href="/{{ guess }}">{{ pattern }}</a</li> 733 737 {% endfor %} 734 738 </ol> 735 739 <p>The current URL, <code>{{ request_path|escape }}</code>, didn't match any of these.</p> … … 742 746 <p> 743 747 You're seeing this error because you have <code>DEBUG = True</code> in 744 748 your Django settings file. Change that to <code>False</code>, and Django 745 will display a standard404 page.749 will display your custom 404 page. 746 750 </p> 751 <br> 752 <p> 753 Note: The above links are formed using .strip('^$').replace(' ','') 754 which does not always result in a usable link. 755 When it does, it is handy. 756 <!-- With enough work it might be posible to craft valid URLs. 757 feel free to do the work and submit it. --> 758 </p> 759 747 760 </div> 748 761 </body> 749 762 </html>