Index: django/views/debug.py
===================================================================
--- django/views/debug.py	(revision 10445)
+++ django/views/debug.py	(working copy)
@@ -93,7 +93,10 @@
                 unicode_str = self.exc_value.args[1]
                 unicode_hint = smart_unicode(unicode_str[max(start-5, 0):min(end+5, len(unicode_str))], 'ascii', errors='replace')
         from django import get_version
-        t = Template(TECHNICAL_500_TEMPLATE, name='Technical 500 template')
+        if self.request.is_ajax(): 
+            t = Template(TECHNICAL_500_TEMPLATE_AJAX, name='Technical 500 template')
+        else:    
+            t = Template(TECHNICAL_500_TEMPLATE, name='Technical 500 template')
         c = Context({
             'exception_type': self.exc_type.__name__,
             'exception_value': smart_unicode(self.exc_value, errors='replace'),
@@ -278,6 +281,85 @@
 # always work even if the template loader is broken.
 #
 
+TECHNICAL_500_TEMPLATE_AJAX = """
+
+{{ exception_type }} at {{ request.path_info|escape }}
+{% autoescape off %}{{ exception_value }}{% endautoescape %}
+
+Request Method: {{ request.META.REQUEST_METHOD }}
+Request URL: {{ request_protocol }}://{{ request.META.HTTP_HOST }}{{ request.path_info|escape }}
+
+Server time: {{server_time|date:"r"}}
+Django Version: {{ django_version_info }}
+Python Version: {{ sys_version_info }}
+Python Path: {% autoescape off %}{{ sys_path }}{% endautoescape %}
+Python Executable: {{ sys_executable|escape }}
+Installed Applications:
+{% autoescape off %}{{ settings.INSTALLED_APPS|pprint }}{% endautoescape %}
+Installed Middleware:
+{% autoescape off %}{{ settings.MIDDLEWARE_CLASSES|pprint }}{% endautoescape %}
+
+{% if template_does_not_exist %}Template Loader Error:
+{% if loader_debug_info %}Django tried loading these templates, in this order:
+{% for loader in loader_debug_info %}Using loader {{ loader.loader }}:
+{% for t in loader.templates %}{{ t.name }} (File {% if t.exists %}exists{% else %}does not exist{% endif %})
+{% endfor %}{% endfor %}
+{% else %}Django couldn't find any templates because your TEMPLATE_LOADERS setting is empty!
+{% endif %}
+{% endif %}{% if template_info %}
+Template error:
+In template {{ template_info.name }}, error at line {{ template_info.line }}
+   {{ template_info.message }}{% for source_line in template_info.source_lines %}{% ifequal source_line.0 template_info.line %}
+   {{ source_line.0 }} : {{ template_info.before }} {{ template_info.during }} {{ template_info.after }}
+{% else %}
+   {{ source_line.0 }} : {{ source_line.1 }}
+{% endifequal %}{% endfor %}{% endif %}
+Traceback:
+{% for frame in frames %}File "{{ frame.filename|escape }}" in {{ frame.function|escape }}
+{% if frame.context_line %}  {{ frame.lineno }}. {{ frame.context_line|escape }}{% endif %}
+{% endfor %}
+Exception Type: {% autoescape off %}{{ exception_type }} at {{ request.path_info }}{% endautoescape %}
+Exception Value: {% autoescape off %}{{ exception_value }}{% endautoescape %}
+
+Request information:
+GET:{% if request.GET %}{% for var in request.GET.items %}{% autoescape off %}{{ var.0 }} = {{ var.1 }}{% endautoescape %}
+{% endfor %}
+{% else %} No GET data
+{% endif %}
+
+POST:{% if request.POST %} 
+{% for var in request.POST.items %}{% autoescape off %}{{ var.0 }} = {{ var.1 }}{% endautoescape %}
+{% endfor %}
+{% else %} No POST data
+{% endif %}
+ 
+FILES:{% if request.FILES %}
+{% for var in request.FILES.items %}{% autoescape off %}{{ var.0 }} = {{ var.1 }}{% endautoescape %}
+{% endfor %}
+{% else %} No FILES data
+{% endif %}
+
+COOKIES:{% if request.COOKIES %}
+{% for var in request.COOKIES.items %}{% autoescape off %}{{ var.0 }} = {{ var.1 }}{% endautoescape %}
+{% endfor %}
+{% else %} No cookie data
+{% endif %}
+
+META:
+{% for var in request.META.items|dictsort:"0" %}{% autoescape off %}{{ var.0 }} = {{ var.1 }}{% endautoescape %}
+{% endfor %}
+ 
+Settings:
+Using settings module {{ settings.SETTINGS_MODULE }}
+{% for var in settings.items|dictsort:"0" %}{% autoescape off %}{{ var.0 }} = {{ var.1 }}{% endautoescape %}
+{% endfor %}
+
+    You're seeing this error because you have DEBUG = True in your
+    Django settings file. Change that to False, and Django will
+    display a standard 500 page.
+
+"""
+
 TECHNICAL_500_TEMPLATE = """
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <html lang="en">
