Ticket #4335: sys-info-debug-500-error.patch

File sys-info-debug-500-error.patch, 1.3 KB (added by pete.crosier@…, 17 years ago)

Includes the Python executable path and version in the 500 error pages whilst debugging

  • django/views/debug.py

     
    22from django.template import Template, Context, TemplateDoesNotExist
    33from django.utils.html import escape
    44from django.http import HttpResponseServerError, HttpResponseNotFound
    5 import os, re
     5import os, re, sys
    66
    77HIDDEN_SETTINGS = re.compile('SECRET|PASSWORD|PROFANITIES_LIST')
    88
     
    131131        'request': request,
    132132        'request_protocol': request.is_secure() and "https" or "http",
    133133        'settings': get_safe_settings(),
     134        'sys_executable' : sys.executable,
     135        'sys_version_info' : '%d.%d.%d' % sys.version_info[0:3],
    134136        'template_info': template_info,
    135137        'template_does_not_exist': template_does_not_exist,
    136138        'loader_debug_info': loader_debug_info,
     
    334336      <th>Exception Location:</th>
    335337      <td>{{ lastframe.filename|escape }} in {{ lastframe.function|escape }}, line {{ lastframe.lineno }}</td>
    336338    </tr>
     339    <tr>
     340      <th>Python Executable:</th>
     341      <td>{{ sys_executable|escape }}</td>
     342    </tr>
     343    <tr>
     344      <th>Python Version:</th>
     345      <td>{{ sys_version_info }}</td>
     346    </tr>
    337347  </table>
    338348</div>
    339349{% if template_does_not_exist %}
Back to Top