Ticket #7269: debug.py.3.diff
File debug.py.3.diff, 2.0 KB (added by , 16 years ago) |
---|
-
views/debug.py
178 178 if not tried: 179 179 # tried exists but is an empty list. The URLconf must've been empty. 180 180 return empty_urlconf(request) 181 urlpatterns = [(t,t.strip('^$')) for t in tried] 181 182 182 183 t = Template(TECHNICAL_404_TEMPLATE, name='Technical 404 template') 183 184 c = Context({ 184 185 'root_urlconf': settings.ROOT_URLCONF, 185 186 'request_path': request.path[1:], # Trim leading slash 186 'urlpatterns': tried,187 'urlpatterns': urlpatterns, 187 188 'reason': str(exception), 188 189 'request': request, 189 190 'request_protocol': request.is_secure() and "https" or "http", … … 696 697 Django tried these URL patterns, in this order: 697 698 </p> 698 699 <ol> 699 {% for pattern in urlpatterns %}700 <li> {{ pattern }}</li>700 {% for pattern,guess in urlpatterns %} 701 <li><a href="{{ guess }}">{{ pattern }}</a</li> 701 702 {% endfor %} 702 703 </ol> 703 <p>The current URL, <code>{{ request_path|escape }}</code>, didn't match any of these.</p>704 <p>The current URL, "<code>{{ request_path|escape }}</code>", didn't match any of these.</p> 704 705 {% else %} 705 706 <p>{{ reason }}</p> 706 707 {% endif %} … … 710 711 <p> 711 712 You're seeing this error because you have <code>DEBUG = True</code> in 712 713 your Django settings file. Change that to <code>False</code>, and Django 713 will display a standard404 page.714 will display your custom 404 page. 714 715 </p> 716 <br> 717 <p> 718 Note: The above links are formed using .strip('^$').replace(' ','') 719 This does not always result in a usable link, 720 but when it does, it is handy. 721 <!-- With enough work it might be posible to craft valid URLs. 722 feel free to do the work and submit it. --> 723 </p> 724 715 725 </div> 716 726 </body> 717 727 </html>