2012-06-08 00:08:47 +08:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2010-02-25 05:58:01 +08:00
|
|
|
import datetime
|
2007-12-11 13:38:34 +08:00
|
|
|
import os
|
|
|
|
import re
|
|
|
|
import sys
|
2010-12-13 06:54:04 +08:00
|
|
|
import types
|
2007-12-11 13:38:34 +08:00
|
|
|
|
2005-11-15 01:44:50 +08:00
|
|
|
from django.conf import settings
|
2011-07-29 17:39:35 +08:00
|
|
|
from django.core.exceptions import ImproperlyConfigured
|
2011-06-09 06:18:46 +08:00
|
|
|
from django.http import (HttpResponse, HttpResponseServerError,
|
2011-06-10 07:15:42 +08:00
|
|
|
HttpResponseNotFound, HttpRequest, build_request_repr)
|
2011-09-16 09:16:25 +08:00
|
|
|
from django.template import Template, Context, TemplateDoesNotExist
|
2011-01-13 21:47:03 +08:00
|
|
|
from django.template.defaultfilters import force_escape, pprint
|
2005-11-24 07:10:17 +08:00
|
|
|
from django.utils.html import escape
|
2009-03-19 00:55:59 +08:00
|
|
|
from django.utils.importlib import import_module
|
2012-08-29 02:59:56 +08:00
|
|
|
from django.utils.encoding import force_bytes, smart_text
|
2012-07-20 20:22:00 +08:00
|
|
|
from django.utils import six
|
2005-11-15 01:44:50 +08:00
|
|
|
|
2012-02-10 02:58:45 +08:00
|
|
|
HIDDEN_SETTINGS = re.compile('API|TOKEN|KEY|SECRET|PASS|PROFANITIES_LIST|SIGNATURE')
|
2005-11-15 22:35:24 +08:00
|
|
|
|
2012-06-08 00:08:47 +08:00
|
|
|
CLEANSED_SUBSTITUTE = '********************'
|
2011-06-09 06:18:46 +08:00
|
|
|
|
2005-11-24 07:10:17 +08:00
|
|
|
def linebreak_iter(template_source):
|
2005-11-25 07:31:33 +08:00
|
|
|
yield 0
|
2005-11-24 08:06:36 +08:00
|
|
|
p = template_source.find('\n')
|
|
|
|
while p >= 0:
|
2005-11-25 08:04:06 +08:00
|
|
|
yield p+1
|
2005-11-24 08:06:36 +08:00
|
|
|
p = template_source.find('\n', p+1)
|
2005-11-24 07:10:17 +08:00
|
|
|
yield len(template_source) + 1
|
|
|
|
|
2010-01-31 10:30:02 +08:00
|
|
|
def cleanse_setting(key, value):
|
|
|
|
"""Cleanse an individual setting key/value of sensitive content.
|
|
|
|
|
|
|
|
If the value is a dictionary, recursively cleanse the keys in
|
|
|
|
that dictionary.
|
|
|
|
"""
|
2010-02-01 07:38:17 +08:00
|
|
|
try:
|
|
|
|
if HIDDEN_SETTINGS.search(key):
|
2011-06-09 06:18:46 +08:00
|
|
|
cleansed = CLEANSED_SUBSTITUTE
|
2010-01-31 10:30:02 +08:00
|
|
|
else:
|
2010-02-01 07:38:17 +08:00
|
|
|
if isinstance(value, dict):
|
|
|
|
cleansed = dict((k, cleanse_setting(k, v)) for k,v in value.items())
|
|
|
|
else:
|
|
|
|
cleansed = value
|
|
|
|
except TypeError:
|
|
|
|
# If the key isn't regex-able, just return as-is.
|
|
|
|
cleansed = value
|
2010-01-31 10:30:02 +08:00
|
|
|
return cleansed
|
|
|
|
|
2005-12-07 14:02:09 +08:00
|
|
|
def get_safe_settings():
|
|
|
|
"Returns a dictionary of the settings module, with sensitive settings blurred out."
|
|
|
|
settings_dict = {}
|
|
|
|
for k in dir(settings):
|
|
|
|
if k.isupper():
|
2010-01-31 10:30:02 +08:00
|
|
|
settings_dict[k] = cleanse_setting(k, getattr(settings, k))
|
2005-12-07 14:02:09 +08:00
|
|
|
return settings_dict
|
|
|
|
|
2005-11-15 01:44:50 +08:00
|
|
|
def technical_500_response(request, exc_type, exc_value, tb):
|
|
|
|
"""
|
2005-12-07 14:02:09 +08:00
|
|
|
Create a technical server error response. The last three arguments are
|
2005-11-15 01:44:50 +08:00
|
|
|
the values returned from sys.exc_info() and friends.
|
|
|
|
"""
|
2008-07-16 02:47:49 +08:00
|
|
|
reporter = ExceptionReporter(request, exc_type, exc_value, tb)
|
2011-10-02 10:53:58 +08:00
|
|
|
if request.is_ajax():
|
|
|
|
text = reporter.get_traceback_text()
|
2012-07-01 03:19:07 +08:00
|
|
|
return HttpResponseServerError(text, content_type='text/plain')
|
2011-10-02 10:53:58 +08:00
|
|
|
else:
|
|
|
|
html = reporter.get_traceback_html()
|
2012-07-01 03:19:07 +08:00
|
|
|
return HttpResponseServerError(html, content_type='text/html')
|
2008-03-18 22:34:48 +08:00
|
|
|
|
2011-06-09 06:18:46 +08:00
|
|
|
# Cache for the default exception reporter filter instance.
|
|
|
|
default_exception_reporter_filter = None
|
|
|
|
|
|
|
|
def get_exception_reporter_filter(request):
|
|
|
|
global default_exception_reporter_filter
|
|
|
|
if default_exception_reporter_filter is None:
|
|
|
|
# Load the default filter for the first time and cache it.
|
|
|
|
modpath = settings.DEFAULT_EXCEPTION_REPORTER_FILTER
|
|
|
|
modname, classname = modpath.rsplit('.', 1)
|
|
|
|
try:
|
|
|
|
mod = import_module(modname)
|
2012-04-29 00:09:37 +08:00
|
|
|
except ImportError as e:
|
2011-06-09 06:18:46 +08:00
|
|
|
raise ImproperlyConfigured(
|
|
|
|
'Error importing default exception reporter filter %s: "%s"' % (modpath, e))
|
|
|
|
try:
|
|
|
|
default_exception_reporter_filter = getattr(mod, classname)()
|
|
|
|
except AttributeError:
|
2011-07-29 17:39:35 +08:00
|
|
|
raise ImproperlyConfigured('Default exception reporter filter module "%s" does not define a "%s" class' % (modname, classname))
|
2011-06-09 06:18:46 +08:00
|
|
|
if request:
|
|
|
|
return getattr(request, 'exception_reporter_filter', default_exception_reporter_filter)
|
|
|
|
else:
|
|
|
|
return default_exception_reporter_filter
|
|
|
|
|
|
|
|
class ExceptionReporterFilter(object):
|
|
|
|
"""
|
|
|
|
Base for all exception reporter filter classes. All overridable hooks
|
2011-12-18 01:37:24 +08:00
|
|
|
contain lenient default behaviors.
|
2011-06-09 06:18:46 +08:00
|
|
|
"""
|
|
|
|
|
|
|
|
def get_request_repr(self, request):
|
|
|
|
if request is None:
|
|
|
|
return repr(None)
|
|
|
|
else:
|
2011-06-10 07:15:42 +08:00
|
|
|
return build_request_repr(request, POST_override=self.get_post_parameters(request))
|
2011-06-09 06:18:46 +08:00
|
|
|
|
|
|
|
def get_post_parameters(self, request):
|
|
|
|
if request is None:
|
|
|
|
return {}
|
|
|
|
else:
|
|
|
|
return request.POST
|
|
|
|
|
|
|
|
def get_traceback_frame_variables(self, request, tb_frame):
|
2012-07-21 03:14:27 +08:00
|
|
|
return list(six.iteritems(tb_frame.f_locals))
|
2011-06-09 06:18:46 +08:00
|
|
|
|
|
|
|
class SafeExceptionReporterFilter(ExceptionReporterFilter):
|
|
|
|
"""
|
|
|
|
Use annotations made by the sensitive_post_parameters and
|
|
|
|
sensitive_variables decorators to filter out sensitive information.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def is_active(self, request):
|
|
|
|
"""
|
|
|
|
This filter is to add safety in production environments (i.e. DEBUG
|
|
|
|
is False). If DEBUG is True then your site is not safe anyway.
|
|
|
|
This hook is provided as a convenience to easily activate or
|
|
|
|
deactivate the filter on a per request basis.
|
|
|
|
"""
|
|
|
|
return settings.DEBUG is False
|
|
|
|
|
|
|
|
def get_post_parameters(self, request):
|
|
|
|
"""
|
|
|
|
Replaces the values of POST parameters marked as sensitive with
|
|
|
|
stars (*********).
|
|
|
|
"""
|
|
|
|
if request is None:
|
|
|
|
return {}
|
|
|
|
else:
|
|
|
|
sensitive_post_parameters = getattr(request, 'sensitive_post_parameters', [])
|
|
|
|
if self.is_active(request) and sensitive_post_parameters:
|
|
|
|
cleansed = request.POST.copy()
|
|
|
|
if sensitive_post_parameters == '__ALL__':
|
|
|
|
# Cleanse all parameters.
|
|
|
|
for k, v in cleansed.items():
|
|
|
|
cleansed[k] = CLEANSED_SUBSTITUTE
|
|
|
|
return cleansed
|
|
|
|
else:
|
|
|
|
# Cleanse only the specified parameters.
|
|
|
|
for param in sensitive_post_parameters:
|
2011-09-10 03:33:40 +08:00
|
|
|
if param in cleansed:
|
2011-06-09 06:18:46 +08:00
|
|
|
cleansed[param] = CLEANSED_SUBSTITUTE
|
|
|
|
return cleansed
|
|
|
|
else:
|
|
|
|
return request.POST
|
|
|
|
|
|
|
|
def get_traceback_frame_variables(self, request, tb_frame):
|
|
|
|
"""
|
|
|
|
Replaces the values of variables marked as sensitive with
|
|
|
|
stars (*********).
|
|
|
|
"""
|
2012-06-04 08:33:09 +08:00
|
|
|
# Loop through the frame's callers to see if the sensitive_variables
|
|
|
|
# decorator was used.
|
|
|
|
current_frame = tb_frame.f_back
|
|
|
|
sensitive_variables = None
|
|
|
|
while current_frame is not None:
|
|
|
|
if (current_frame.f_code.co_name == 'sensitive_variables_wrapper'
|
|
|
|
and 'sensitive_variables_wrapper' in current_frame.f_locals):
|
|
|
|
# The sensitive_variables decorator was used, so we take note
|
|
|
|
# of the sensitive variables' names.
|
|
|
|
wrapper = current_frame.f_locals['sensitive_variables_wrapper']
|
|
|
|
sensitive_variables = getattr(wrapper, 'sensitive_variables', None)
|
|
|
|
break
|
|
|
|
current_frame = current_frame.f_back
|
|
|
|
|
2011-06-09 06:18:46 +08:00
|
|
|
cleansed = []
|
|
|
|
if self.is_active(request) and sensitive_variables:
|
|
|
|
if sensitive_variables == '__ALL__':
|
|
|
|
# Cleanse all variables
|
|
|
|
for name, value in tb_frame.f_locals.items():
|
|
|
|
cleansed.append((name, CLEANSED_SUBSTITUTE))
|
|
|
|
return cleansed
|
|
|
|
else:
|
|
|
|
# Cleanse specified variables
|
|
|
|
for name, value in tb_frame.f_locals.items():
|
|
|
|
if name in sensitive_variables:
|
|
|
|
value = CLEANSED_SUBSTITUTE
|
|
|
|
elif isinstance(value, HttpRequest):
|
|
|
|
# Cleanse the request's POST parameters.
|
|
|
|
value = self.get_request_repr(value)
|
|
|
|
cleansed.append((name, value))
|
|
|
|
return cleansed
|
|
|
|
else:
|
|
|
|
# Potentially cleanse only the request if it's one of the frame variables.
|
|
|
|
for name, value in tb_frame.f_locals.items():
|
|
|
|
if isinstance(value, HttpRequest):
|
|
|
|
# Cleanse the request's POST parameters.
|
|
|
|
value = self.get_request_repr(value)
|
|
|
|
cleansed.append((name, value))
|
|
|
|
return cleansed
|
|
|
|
|
2011-02-01 22:18:07 +08:00
|
|
|
class ExceptionReporter(object):
|
2008-07-16 02:47:49 +08:00
|
|
|
"""
|
|
|
|
A class to organize and coordinate reporting on exceptions.
|
|
|
|
"""
|
2010-12-06 22:21:51 +08:00
|
|
|
def __init__(self, request, exc_type, exc_value, tb, is_email=False):
|
2008-07-16 02:47:49 +08:00
|
|
|
self.request = request
|
2011-06-09 06:18:46 +08:00
|
|
|
self.filter = get_exception_reporter_filter(self.request)
|
2008-07-16 02:47:49 +08:00
|
|
|
self.exc_type = exc_type
|
|
|
|
self.exc_value = exc_value
|
|
|
|
self.tb = tb
|
2010-12-06 22:21:51 +08:00
|
|
|
self.is_email = is_email
|
2008-07-16 02:47:49 +08:00
|
|
|
|
|
|
|
self.template_info = None
|
|
|
|
self.template_does_not_exist = False
|
|
|
|
self.loader_debug_info = None
|
|
|
|
|
|
|
|
# Handle deprecated string exceptions
|
2012-07-20 20:22:00 +08:00
|
|
|
if isinstance(self.exc_type, six.string_types):
|
2008-07-16 02:47:49 +08:00
|
|
|
self.exc_value = Exception('Deprecated String Exception: %r' % self.exc_type)
|
|
|
|
self.exc_type = type(self.exc_value)
|
|
|
|
|
2011-10-02 10:53:58 +08:00
|
|
|
def get_traceback_data(self):
|
|
|
|
"Return a Context instance containing traceback information."
|
2008-07-16 02:47:49 +08:00
|
|
|
|
2011-02-01 22:18:07 +08:00
|
|
|
if self.exc_type and issubclass(self.exc_type, TemplateDoesNotExist):
|
2008-07-16 02:47:49 +08:00
|
|
|
from django.template.loader import template_source_loaders
|
|
|
|
self.template_does_not_exist = True
|
|
|
|
self.loader_debug_info = []
|
|
|
|
for loader in template_source_loaders:
|
|
|
|
try:
|
2011-04-03 02:48:18 +08:00
|
|
|
source_list_func = loader.get_template_sources
|
2008-07-16 02:47:49 +08:00
|
|
|
# NOTE: This assumes exc_value is the name of the template that
|
|
|
|
# the loader attempted to load.
|
|
|
|
template_list = [{'name': t, 'exists': os.path.exists(t)} \
|
|
|
|
for t in source_list_func(str(self.exc_value))]
|
2011-04-03 02:48:18 +08:00
|
|
|
except AttributeError:
|
2008-07-16 02:47:49 +08:00
|
|
|
template_list = []
|
2011-04-03 02:48:18 +08:00
|
|
|
loader_name = loader.__module__ + '.' + loader.__class__.__name__
|
2008-07-16 02:47:49 +08:00
|
|
|
self.loader_debug_info.append({
|
2009-12-14 20:08:23 +08:00
|
|
|
'loader': loader_name,
|
2008-07-16 02:47:49 +08:00
|
|
|
'templates': template_list,
|
|
|
|
})
|
2011-09-16 09:16:25 +08:00
|
|
|
if (settings.TEMPLATE_DEBUG and
|
|
|
|
hasattr(self.exc_value, 'django_template_source')):
|
2008-07-16 02:47:49 +08:00
|
|
|
self.get_template_exception_info()
|
2008-02-03 10:24:56 +08:00
|
|
|
|
2008-07-16 02:47:49 +08:00
|
|
|
frames = self.get_traceback_frames()
|
2011-01-13 21:47:03 +08:00
|
|
|
for i, frame in enumerate(frames):
|
2011-02-01 22:18:07 +08:00
|
|
|
if 'vars' in frame:
|
|
|
|
frame['vars'] = [(k, force_escape(pprint(v))) for k, v in frame['vars']]
|
2011-01-13 21:47:03 +08:00
|
|
|
frames[i] = frame
|
2008-02-03 10:24:56 +08:00
|
|
|
|
2008-07-16 02:47:49 +08:00
|
|
|
unicode_hint = ''
|
2011-02-01 22:18:07 +08:00
|
|
|
if self.exc_type and issubclass(self.exc_type, UnicodeError):
|
2008-07-16 02:47:49 +08:00
|
|
|
start = getattr(self.exc_value, 'start', None)
|
|
|
|
end = getattr(self.exc_value, 'end', None)
|
|
|
|
if start is not None and end is not None:
|
|
|
|
unicode_str = self.exc_value.args[1]
|
2012-07-21 16:00:10 +08:00
|
|
|
unicode_hint = smart_text(unicode_str[max(start-5, 0):min(end+5, len(unicode_str))], 'ascii', errors='replace')
|
2008-07-16 02:47:49 +08:00
|
|
|
from django import get_version
|
2011-10-02 10:53:58 +08:00
|
|
|
c = {
|
2010-12-06 22:21:51 +08:00
|
|
|
'is_email': self.is_email,
|
2008-07-16 02:47:49 +08:00
|
|
|
'unicode_hint': unicode_hint,
|
|
|
|
'frames': frames,
|
|
|
|
'request': self.request,
|
2011-06-09 06:18:46 +08:00
|
|
|
'filtered_POST': self.filter.get_post_parameters(self.request),
|
2008-07-16 02:47:49 +08:00
|
|
|
'settings': get_safe_settings(),
|
|
|
|
'sys_executable': sys.executable,
|
|
|
|
'sys_version_info': '%d.%d.%d' % sys.version_info[0:3],
|
|
|
|
'server_time': datetime.datetime.now(),
|
|
|
|
'django_version_info': get_version(),
|
|
|
|
'sys_path' : sys.path,
|
|
|
|
'template_info': self.template_info,
|
|
|
|
'template_does_not_exist': self.template_does_not_exist,
|
|
|
|
'loader_debug_info': self.loader_debug_info,
|
2011-10-02 10:53:58 +08:00
|
|
|
}
|
2011-02-01 22:18:07 +08:00
|
|
|
# Check whether exception info is available
|
|
|
|
if self.exc_type:
|
|
|
|
c['exception_type'] = self.exc_type.__name__
|
|
|
|
if self.exc_value:
|
2012-07-21 16:00:10 +08:00
|
|
|
c['exception_value'] = smart_text(self.exc_value, errors='replace')
|
2011-02-01 22:18:07 +08:00
|
|
|
if frames:
|
|
|
|
c['lastframe'] = frames[-1]
|
2011-10-02 10:53:58 +08:00
|
|
|
return c
|
|
|
|
|
|
|
|
def get_traceback_html(self):
|
|
|
|
"Return HTML version of debug 500 HTTP error page."
|
|
|
|
t = Template(TECHNICAL_500_TEMPLATE, name='Technical 500 template')
|
|
|
|
c = Context(self.get_traceback_data())
|
|
|
|
return t.render(c)
|
|
|
|
|
|
|
|
def get_traceback_text(self):
|
|
|
|
"Return plain text version of debug 500 HTTP error page."
|
|
|
|
t = Template(TECHNICAL_500_TEXT_TEMPLATE, name='Technical 500 template')
|
|
|
|
c = Context(self.get_traceback_data(), autoescape=False)
|
2008-07-16 02:47:49 +08:00
|
|
|
return t.render(c)
|
|
|
|
|
|
|
|
def get_template_exception_info(self):
|
2011-09-16 09:16:25 +08:00
|
|
|
origin, (start, end) = self.exc_value.django_template_source
|
2008-07-16 02:47:49 +08:00
|
|
|
template_source = origin.reload()
|
|
|
|
context_lines = 10
|
|
|
|
line = 0
|
|
|
|
upto = 0
|
|
|
|
source_lines = []
|
|
|
|
before = during = after = ""
|
|
|
|
for num, next in enumerate(linebreak_iter(template_source)):
|
|
|
|
if start >= upto and end <= next:
|
|
|
|
line = num
|
|
|
|
before = escape(template_source[upto:start])
|
|
|
|
during = escape(template_source[start:end])
|
|
|
|
after = escape(template_source[end:next])
|
|
|
|
source_lines.append( (num, escape(template_source[upto:next])) )
|
|
|
|
upto = next
|
|
|
|
total = len(source_lines)
|
|
|
|
|
|
|
|
top = max(1, line - context_lines)
|
|
|
|
bottom = min(total, line + 1 + context_lines)
|
|
|
|
|
2011-12-23 06:08:32 +08:00
|
|
|
# In some rare cases, exc_value.args might be empty.
|
|
|
|
try:
|
|
|
|
message = self.exc_value.args[0]
|
|
|
|
except IndexError:
|
|
|
|
message = '(Could not get exception message)'
|
|
|
|
|
2008-07-16 02:47:49 +08:00
|
|
|
self.template_info = {
|
2011-12-23 06:08:32 +08:00
|
|
|
'message': message,
|
2008-07-16 02:47:49 +08:00
|
|
|
'source_lines': source_lines[top:bottom],
|
|
|
|
'before': before,
|
|
|
|
'during': during,
|
|
|
|
'after': after,
|
|
|
|
'top': top,
|
|
|
|
'bottom': bottom,
|
|
|
|
'total': total,
|
|
|
|
'line': line,
|
|
|
|
'name': origin.name,
|
|
|
|
}
|
|
|
|
|
|
|
|
def _get_lines_from_file(self, filename, lineno, context_lines, loader=None, module_name=None):
|
|
|
|
"""
|
|
|
|
Returns context_lines before and after lineno from file.
|
|
|
|
Returns (pre_context_lineno, pre_context, context_line, post_context).
|
|
|
|
"""
|
|
|
|
source = None
|
|
|
|
if loader is not None and hasattr(loader, "get_source"):
|
|
|
|
source = loader.get_source(module_name)
|
|
|
|
if source is not None:
|
|
|
|
source = source.splitlines()
|
|
|
|
if source is None:
|
2005-11-25 05:15:51 +08:00
|
|
|
try:
|
2012-05-19 23:43:34 +08:00
|
|
|
with open(filename, 'rb') as fp:
|
2012-05-05 20:01:38 +08:00
|
|
|
source = fp.readlines()
|
2008-07-16 02:47:49 +08:00
|
|
|
except (OSError, IOError):
|
|
|
|
pass
|
|
|
|
if source is None:
|
|
|
|
return None, [], None, []
|
|
|
|
|
|
|
|
encoding = 'ascii'
|
|
|
|
for line in source[:2]:
|
|
|
|
# File coding may be specified. Match pattern from PEP-263
|
|
|
|
# (http://www.python.org/dev/peps/pep-0263/)
|
2012-06-08 00:08:47 +08:00
|
|
|
match = re.search(br'coding[:=]\s*([-\w.]+)', line)
|
2008-07-16 02:47:49 +08:00
|
|
|
if match:
|
|
|
|
encoding = match.group(1)
|
|
|
|
break
|
2012-07-20 20:48:51 +08:00
|
|
|
source = [six.text_type(sline, encoding, 'replace') for sline in source]
|
2008-07-16 02:47:49 +08:00
|
|
|
|
|
|
|
lower_bound = max(0, lineno - context_lines)
|
|
|
|
upper_bound = lineno + context_lines
|
|
|
|
|
|
|
|
pre_context = [line.strip('\n') for line in source[lower_bound:lineno]]
|
|
|
|
context_line = source[lineno].strip('\n')
|
|
|
|
post_context = [line.strip('\n') for line in source[lineno+1:upper_bound]]
|
|
|
|
|
|
|
|
return lower_bound, pre_context, context_line, post_context
|
|
|
|
|
|
|
|
def get_traceback_frames(self):
|
|
|
|
frames = []
|
|
|
|
tb = self.tb
|
|
|
|
while tb is not None:
|
2011-06-09 06:18:46 +08:00
|
|
|
# Support for __traceback_hide__ which is used by a few libraries
|
2008-07-16 02:47:49 +08:00
|
|
|
# to hide internal frames.
|
|
|
|
if tb.tb_frame.f_locals.get('__traceback_hide__'):
|
|
|
|
tb = tb.tb_next
|
|
|
|
continue
|
|
|
|
filename = tb.tb_frame.f_code.co_filename
|
|
|
|
function = tb.tb_frame.f_code.co_name
|
|
|
|
lineno = tb.tb_lineno - 1
|
|
|
|
loader = tb.tb_frame.f_globals.get('__loader__')
|
2011-06-09 20:45:11 +08:00
|
|
|
module_name = tb.tb_frame.f_globals.get('__name__') or ''
|
2008-07-16 02:47:49 +08:00
|
|
|
pre_context_lineno, pre_context, context_line, post_context = self._get_lines_from_file(filename, lineno, 7, loader, module_name)
|
|
|
|
if pre_context_lineno is not None:
|
|
|
|
frames.append({
|
|
|
|
'tb': tb,
|
2011-06-09 20:45:11 +08:00
|
|
|
'type': module_name.startswith('django.') and 'django' or 'user',
|
2008-07-16 02:47:49 +08:00
|
|
|
'filename': filename,
|
|
|
|
'function': function,
|
|
|
|
'lineno': lineno + 1,
|
2011-06-09 06:18:46 +08:00
|
|
|
'vars': self.filter.get_traceback_frame_variables(self.request, tb.tb_frame),
|
2008-07-16 02:47:49 +08:00
|
|
|
'id': id(tb),
|
|
|
|
'pre_context': pre_context,
|
|
|
|
'context_line': context_line,
|
|
|
|
'post_context': post_context,
|
|
|
|
'pre_context_lineno': pre_context_lineno + 1,
|
|
|
|
})
|
2007-04-21 12:37:31 +08:00
|
|
|
tb = tb.tb_next
|
2005-11-17 11:10:03 +08:00
|
|
|
|
2008-07-16 02:47:49 +08:00
|
|
|
return frames
|
|
|
|
|
|
|
|
def format_exception(self):
|
|
|
|
"""
|
|
|
|
Return the same data as from traceback.format_exception.
|
|
|
|
"""
|
|
|
|
import traceback
|
|
|
|
frames = self.get_traceback_frames()
|
|
|
|
tb = [ (f['filename'], f['lineno'], f['function'], f['context_line']) for f in frames ]
|
|
|
|
list = ['Traceback (most recent call last):\n']
|
|
|
|
list += traceback.format_list(tb)
|
|
|
|
list += traceback.format_exception_only(self.exc_type, self.exc_value)
|
|
|
|
return list
|
2007-08-12 11:23:53 +08:00
|
|
|
|
2005-11-15 01:44:50 +08:00
|
|
|
|
|
|
|
def technical_404_response(request, exception):
|
2005-12-07 14:02:09 +08:00
|
|
|
"Create a technical 404 error response. The exception should be the Http404."
|
2005-11-15 01:44:50 +08:00
|
|
|
try:
|
|
|
|
tried = exception.args[0]['tried']
|
2010-03-06 02:53:07 +08:00
|
|
|
except (IndexError, TypeError, KeyError):
|
2005-11-15 01:44:50 +08:00
|
|
|
tried = []
|
2005-12-06 13:04:56 +08:00
|
|
|
else:
|
|
|
|
if not tried:
|
|
|
|
# tried exists but is an empty list. The URLconf must've been empty.
|
2005-12-07 14:02:09 +08:00
|
|
|
return empty_urlconf(request)
|
2005-11-17 11:10:03 +08:00
|
|
|
|
2010-12-13 06:54:04 +08:00
|
|
|
urlconf = getattr(request, 'urlconf', settings.ROOT_URLCONF)
|
|
|
|
if isinstance(urlconf, types.ModuleType):
|
|
|
|
urlconf = urlconf.__name__
|
|
|
|
|
2006-09-05 07:49:14 +08:00
|
|
|
t = Template(TECHNICAL_404_TEMPLATE, name='Technical 404 template')
|
2005-11-15 01:44:50 +08:00
|
|
|
c = Context({
|
2010-12-13 06:54:04 +08:00
|
|
|
'urlconf': urlconf,
|
2005-11-24 07:10:17 +08:00
|
|
|
'root_urlconf': settings.ROOT_URLCONF,
|
2008-08-28 03:59:29 +08:00
|
|
|
'request_path': request.path_info[1:], # Trim leading slash
|
2005-11-24 07:10:17 +08:00
|
|
|
'urlpatterns': tried,
|
2012-08-29 02:59:56 +08:00
|
|
|
'reason': force_bytes(exception, errors='replace'),
|
2005-11-24 07:10:17 +08:00
|
|
|
'request': request,
|
2005-12-07 14:02:09 +08:00
|
|
|
'settings': get_safe_settings(),
|
|
|
|
})
|
2012-07-01 03:19:07 +08:00
|
|
|
return HttpResponseNotFound(t.render(c), content_type='text/html')
|
2005-12-07 14:02:09 +08:00
|
|
|
|
|
|
|
def empty_urlconf(request):
|
|
|
|
"Create an empty URLconf 404 error response."
|
2006-09-05 07:49:14 +08:00
|
|
|
t = Template(EMPTY_URLCONF_TEMPLATE, name='Empty URLConf template')
|
2005-12-07 14:02:09 +08:00
|
|
|
c = Context({
|
|
|
|
'project_name': settings.SETTINGS_MODULE.split('.')[0]
|
2005-11-15 01:44:50 +08:00
|
|
|
})
|
2012-07-01 03:19:07 +08:00
|
|
|
return HttpResponse(t.render(c), content_type='text/html')
|
2005-11-15 01:44:50 +08:00
|
|
|
|
|
|
|
#
|
|
|
|
# Templates are embedded in the file so that we know the error handler will
|
|
|
|
# always work even if the template loader is broken.
|
|
|
|
#
|
|
|
|
|
|
|
|
TECHNICAL_500_TEMPLATE = """
|
2011-04-21 01:44:29 +08:00
|
|
|
<!DOCTYPE html>
|
2005-11-15 01:44:50 +08:00
|
|
|
<html lang="en">
|
|
|
|
<head>
|
2007-12-04 14:39:05 +08:00
|
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
|
|
|
<meta name="robots" content="NONE,NOARCHIVE">
|
2011-02-01 22:18:07 +08:00
|
|
|
<title>{% if exception_type %}{{ exception_type }}{% else %}Report{% endif %}{% if request %} at {{ request.path_info|escape }}{% endif %}</title>
|
2005-11-15 01:44:50 +08:00
|
|
|
<style type="text/css">
|
|
|
|
html * { padding:0; margin:0; }
|
|
|
|
body * { padding:10px 20px; }
|
|
|
|
body * * { padding:0; }
|
|
|
|
body { font:small sans-serif; }
|
|
|
|
body>div { border-bottom:1px solid #ddd; }
|
|
|
|
h1 { font-weight:normal; }
|
|
|
|
h2 { margin-bottom:.8em; }
|
|
|
|
h2 span { font-size:80%; color:#666; font-weight:normal; }
|
|
|
|
h3 { margin:1em 0 .5em 0; }
|
|
|
|
h4 { margin:0 0 .5em 0; font-weight: normal; }
|
2011-08-22 08:12:51 +08:00
|
|
|
code, pre { font-size: 100%; white-space: pre-wrap; }
|
2005-11-15 01:44:50 +08:00
|
|
|
table { border:1px solid #ccc; border-collapse: collapse; width:100%; background:white; }
|
|
|
|
tbody td, tbody th { vertical-align:top; padding:2px 3px; }
|
|
|
|
thead th { padding:1px 6px 1px 3px; background:#fefefe; text-align:left; font-weight:normal; font-size:11px; border:1px solid #ddd; }
|
|
|
|
tbody th { width:12em; text-align:right; color:#666; padding-right:.5em; }
|
|
|
|
table.vars { margin:5px 0 2px 40px; }
|
|
|
|
table.vars td, table.req td { font-family:monospace; }
|
|
|
|
table td.code { width:100%; }
|
2010-12-06 22:21:51 +08:00
|
|
|
table td.code pre { overflow:hidden; }
|
2005-11-24 07:12:24 +08:00
|
|
|
table.source th { color:#666; }
|
|
|
|
table.source td { font-family:monospace; white-space:pre; border-bottom:1px solid #eee; }
|
2011-06-09 20:45:11 +08:00
|
|
|
ul.traceback { list-style-type:none; color: #222; }
|
|
|
|
ul.traceback li.frame { padding-bottom:1em; color:#666; }
|
|
|
|
ul.traceback li.user { background-color:#e0e0e0; color:#000 }
|
2011-01-24 19:49:11 +08:00
|
|
|
div.context { padding:10px 0; overflow:hidden; }
|
2005-11-15 01:44:50 +08:00
|
|
|
div.context ol { padding-left:30px; margin:0 10px; list-style-position: inside; }
|
2011-06-09 20:45:11 +08:00
|
|
|
div.context ol li { font-family:monospace; white-space:pre; color:#777; cursor:pointer; }
|
2011-01-24 19:49:11 +08:00
|
|
|
div.context ol li pre { display:inline; }
|
2011-06-09 20:45:11 +08:00
|
|
|
div.context ol.context-line li { color:#505050; background-color:#dfdfdf; }
|
2011-01-24 19:49:11 +08:00
|
|
|
div.context ol.context-line li span { position:absolute; right:32px; }
|
2011-06-09 20:45:11 +08:00
|
|
|
.user div.context ol.context-line li { background-color:#bbb; color:#000; }
|
|
|
|
.user div.context ol li { color:#666; }
|
2005-11-15 01:44:50 +08:00
|
|
|
div.commands { margin-left: 40px; }
|
2011-06-09 20:45:11 +08:00
|
|
|
div.commands a { color:#555; text-decoration:none; }
|
|
|
|
.user div.commands a { color: black; }
|
2005-11-15 01:44:50 +08:00
|
|
|
#summary { background: #ffc; }
|
|
|
|
#summary h2 { font-weight: normal; color: #666; }
|
|
|
|
#explanation { background:#eee; }
|
2005-11-25 05:15:51 +08:00
|
|
|
#template, #template-not-exist { background:#f6f6f6; }
|
|
|
|
#template-not-exist ul { margin: 0 0 0 20px; }
|
2007-08-12 11:23:53 +08:00
|
|
|
#unicode-hint { background:#eee; }
|
2005-11-15 01:44:50 +08:00
|
|
|
#traceback { background:#eee; }
|
|
|
|
#requestinfo { background:#f6f6f6; padding-left:120px; }
|
|
|
|
#summary table { border:none; background:transparent; }
|
|
|
|
#requestinfo h2, #requestinfo h3 { position:relative; margin-left:-100px; }
|
|
|
|
#requestinfo h3 { margin-bottom:-1em; }
|
2005-11-24 07:10:17 +08:00
|
|
|
.error { background: #ffc; }
|
2005-11-24 07:12:24 +08:00
|
|
|
.specific { color:#cc3300; font-weight:bold; }
|
2007-12-02 08:00:36 +08:00
|
|
|
h2 span.commands { font-size:.7em;}
|
|
|
|
span.commands a:link {color:#5E5694;}
|
2008-08-16 20:33:36 +08:00
|
|
|
pre.exception_value { font-family: sans-serif; color: #666; font-size: 1.5em; margin: 10px 0 10px 0; }
|
2005-11-15 01:44:50 +08:00
|
|
|
</style>
|
2010-12-06 22:21:51 +08:00
|
|
|
{% if not is_email %}
|
2005-11-15 01:44:50 +08:00
|
|
|
<script type="text/javascript">
|
2005-11-17 22:19:33 +08:00
|
|
|
//<!--
|
2005-11-15 01:44:50 +08:00
|
|
|
function getElementsByClassName(oElm, strTagName, strClassName){
|
|
|
|
// Written by Jonathan Snook, http://www.snook.ca/jon; Add-ons by Robert Nyman, http://www.robertnyman.com
|
2005-11-17 11:10:03 +08:00
|
|
|
var arrElements = (strTagName == "*" && document.all)? document.all :
|
2005-11-15 01:44:50 +08:00
|
|
|
oElm.getElementsByTagName(strTagName);
|
|
|
|
var arrReturnElements = new Array();
|
|
|
|
strClassName = strClassName.replace(/\-/g, "\\-");
|
|
|
|
var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
|
|
|
|
var oElement;
|
|
|
|
for(var i=0; i<arrElements.length; i++){
|
2005-11-17 11:10:03 +08:00
|
|
|
oElement = arrElements[i];
|
2005-11-15 01:44:50 +08:00
|
|
|
if(oRegExp.test(oElement.className)){
|
|
|
|
arrReturnElements.push(oElement);
|
2005-11-17 11:10:03 +08:00
|
|
|
}
|
2005-11-15 01:44:50 +08:00
|
|
|
}
|
|
|
|
return (arrReturnElements)
|
|
|
|
}
|
|
|
|
function hideAll(elems) {
|
2005-11-17 11:10:03 +08:00
|
|
|
for (var e = 0; e < elems.length; e++) {
|
|
|
|
elems[e].style.display = 'none';
|
2005-11-15 01:44:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
window.onload = function() {
|
|
|
|
hideAll(getElementsByClassName(document, 'table', 'vars'));
|
|
|
|
hideAll(getElementsByClassName(document, 'ol', 'pre-context'));
|
|
|
|
hideAll(getElementsByClassName(document, 'ol', 'post-context'));
|
2006-02-28 23:52:57 +08:00
|
|
|
hideAll(getElementsByClassName(document, 'div', 'pastebin'));
|
2005-11-15 01:44:50 +08:00
|
|
|
}
|
|
|
|
function toggle() {
|
|
|
|
for (var i = 0; i < arguments.length; i++) {
|
|
|
|
var e = document.getElementById(arguments[i]);
|
|
|
|
if (e) {
|
|
|
|
e.style.display = e.style.display == 'none' ? 'block' : 'none';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
function varToggle(link, id) {
|
|
|
|
toggle('v' + id);
|
|
|
|
var s = link.getElementsByTagName('span')[0];
|
2005-11-17 11:10:03 +08:00
|
|
|
var uarr = String.fromCharCode(0x25b6);
|
|
|
|
var darr = String.fromCharCode(0x25bc);
|
2005-11-15 01:44:50 +08:00
|
|
|
s.innerHTML = s.innerHTML == uarr ? darr : uarr;
|
|
|
|
return false;
|
|
|
|
}
|
2006-02-28 23:52:57 +08:00
|
|
|
function switchPastebinFriendly(link) {
|
|
|
|
s1 = "Switch to copy-and-paste view";
|
|
|
|
s2 = "Switch back to interactive view";
|
|
|
|
link.innerHTML = link.innerHTML == s1 ? s2 : s1;
|
|
|
|
toggle('browserTraceback', 'pastebinTraceback');
|
|
|
|
return false;
|
|
|
|
}
|
2005-11-17 22:19:33 +08:00
|
|
|
//-->
|
2005-11-15 01:44:50 +08:00
|
|
|
</script>
|
2010-12-06 22:21:51 +08:00
|
|
|
{% endif %}
|
2005-11-15 01:44:50 +08:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="summary">
|
2011-02-01 22:18:07 +08:00
|
|
|
<h1>{% if exception_type %}{{ exception_type }}{% else %}Report{% endif %}{% if request %} at {{ request.path_info|escape }}{% endif %}</h1>
|
|
|
|
<pre class="exception_value">{% if exception_value %}{{ exception_value|force_escape }}{% else %}No exception supplied{% endif %}</pre>
|
2005-11-15 01:44:50 +08:00
|
|
|
<table class="meta">
|
2011-02-01 22:18:07 +08:00
|
|
|
{% if request %}
|
2005-11-15 01:44:50 +08:00
|
|
|
<tr>
|
|
|
|
<th>Request Method:</th>
|
|
|
|
<td>{{ request.META.REQUEST_METHOD }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th>Request URL:</th>
|
2009-04-12 10:23:19 +08:00
|
|
|
<td>{{ request.build_absolute_uri|escape }}</td>
|
2005-11-15 01:44:50 +08:00
|
|
|
</tr>
|
2011-02-01 22:18:07 +08:00
|
|
|
{% endif %}
|
2010-02-25 03:39:04 +08:00
|
|
|
<tr>
|
|
|
|
<th>Django Version:</th>
|
|
|
|
<td>{{ django_version_info }}</td>
|
|
|
|
</tr>
|
2011-02-01 22:18:07 +08:00
|
|
|
{% if exception_type %}
|
2005-11-15 01:44:50 +08:00
|
|
|
<tr>
|
|
|
|
<th>Exception Type:</th>
|
|
|
|
<td>{{ exception_type }}</td>
|
|
|
|
</tr>
|
2011-02-01 22:18:07 +08:00
|
|
|
{% endif %}
|
|
|
|
{% if exception_type and exception_value %}
|
2005-11-15 01:44:50 +08:00
|
|
|
<tr>
|
|
|
|
<th>Exception Value:</th>
|
2010-09-11 10:02:20 +08:00
|
|
|
<td><pre>{{ exception_value|force_escape }}</pre></td>
|
2005-11-15 01:44:50 +08:00
|
|
|
</tr>
|
2011-02-01 22:18:07 +08:00
|
|
|
{% endif %}
|
|
|
|
{% if lastframe %}
|
2005-11-15 01:44:50 +08:00
|
|
|
<tr>
|
|
|
|
<th>Exception Location:</th>
|
2007-04-21 12:37:31 +08:00
|
|
|
<td>{{ lastframe.filename|escape }} in {{ lastframe.function|escape }}, line {{ lastframe.lineno }}</td>
|
2005-11-15 01:44:50 +08:00
|
|
|
</tr>
|
2011-02-01 22:18:07 +08:00
|
|
|
{% endif %}
|
2007-06-10 12:02:29 +08:00
|
|
|
<tr>
|
|
|
|
<th>Python Executable:</th>
|
|
|
|
<td>{{ sys_executable|escape }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th>Python Version:</th>
|
|
|
|
<td>{{ sys_version_info }}</td>
|
|
|
|
</tr>
|
2007-12-11 13:22:11 +08:00
|
|
|
<tr>
|
|
|
|
<th>Python Path:</th>
|
2010-12-06 22:21:51 +08:00
|
|
|
<td><pre>{{ sys_path|pprint }}</pre></td>
|
2007-12-11 13:22:11 +08:00
|
|
|
</tr>
|
2008-03-20 15:01:26 +08:00
|
|
|
<tr>
|
|
|
|
<th>Server time:</th>
|
|
|
|
<td>{{server_time|date:"r"}}</td>
|
|
|
|
</tr>
|
2005-11-15 01:44:50 +08:00
|
|
|
</table>
|
|
|
|
</div>
|
2007-08-12 11:23:53 +08:00
|
|
|
{% if unicode_hint %}
|
|
|
|
<div id="unicode-hint">
|
|
|
|
<h2>Unicode error hint</h2>
|
2010-09-11 10:02:20 +08:00
|
|
|
<p>The string that could not be encoded/decoded was: <strong>{{ unicode_hint|force_escape }}</strong></p>
|
2007-08-12 11:23:53 +08:00
|
|
|
</div>
|
|
|
|
{% endif %}
|
2005-11-25 05:15:51 +08:00
|
|
|
{% if template_does_not_exist %}
|
|
|
|
<div id="template-not-exist">
|
|
|
|
<h2>Template-loader postmortem</h2>
|
|
|
|
{% if loader_debug_info %}
|
|
|
|
<p>Django tried loading these templates, in this order:</p>
|
|
|
|
<ul>
|
|
|
|
{% for loader in loader_debug_info %}
|
|
|
|
<li>Using loader <code>{{ loader.loader }}</code>:
|
|
|
|
<ul>{% for t in loader.templates %}<li><code>{{ t.name }}</code> (File {% if t.exists %}exists{% else %}does not exist{% endif %})</li>{% endfor %}</ul>
|
|
|
|
</li>
|
|
|
|
{% endfor %}
|
|
|
|
</ul>
|
|
|
|
{% else %}
|
|
|
|
<p>Django couldn't find any templates because your <code>TEMPLATE_LOADERS</code> setting is empty!</p>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2005-11-24 07:10:17 +08:00
|
|
|
{% if template_info %}
|
|
|
|
<div id="template">
|
2011-09-16 09:16:25 +08:00
|
|
|
<h2>Error during template rendering</h2>
|
2005-11-24 07:15:52 +08:00
|
|
|
<p>In template <code>{{ template_info.name }}</code>, error at line <strong>{{ template_info.line }}</strong></p>
|
2007-11-14 20:58:53 +08:00
|
|
|
<h3>{{ template_info.message }}</h3>
|
2005-11-24 07:10:17 +08:00
|
|
|
<table class="source{% if template_info.top %} cut-top{% endif %}{% ifnotequal template_info.bottom template_info.total %} cut-bottom{% endifnotequal %}">
|
|
|
|
{% for source_line in template_info.source_lines %}
|
|
|
|
{% ifequal source_line.0 template_info.line %}
|
2005-11-24 07:15:52 +08:00
|
|
|
<tr class="error"><th>{{ source_line.0 }}</th>
|
2005-11-24 07:10:17 +08:00
|
|
|
<td>{{ template_info.before }}<span class="specific">{{ template_info.during }}</span>{{ template_info.after }}</td></tr>
|
|
|
|
{% else %}
|
2005-11-24 07:15:52 +08:00
|
|
|
<tr><th>{{ source_line.0 }}</th>
|
2005-11-25 08:04:06 +08:00
|
|
|
<td>{{ source_line.1 }}</td></tr>
|
2005-11-24 07:10:17 +08:00
|
|
|
{% endifequal %}
|
|
|
|
{% endfor %}
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2011-02-01 22:18:07 +08:00
|
|
|
{% if frames %}
|
2005-11-15 01:44:50 +08:00
|
|
|
<div id="traceback">
|
2010-12-06 22:21:51 +08:00
|
|
|
<h2>Traceback <span class="commands">{% if not is_email %}<a href="#" onclick="return switchPastebinFriendly(this);">Switch to copy-and-paste view</a></span>{% endif %}</h2>
|
2007-11-14 20:58:53 +08:00
|
|
|
{% autoescape off %}
|
2006-02-28 23:52:57 +08:00
|
|
|
<div id="browserTraceback">
|
|
|
|
<ul class="traceback">
|
|
|
|
{% for frame in frames %}
|
2011-06-09 20:45:11 +08:00
|
|
|
<li class="frame {{ frame.type }}">
|
2007-04-21 12:37:31 +08:00
|
|
|
<code>{{ frame.filename|escape }}</code> in <code>{{ frame.function|escape }}</code>
|
2005-11-17 11:10:03 +08:00
|
|
|
|
2006-02-28 23:52:57 +08:00
|
|
|
{% if frame.context_line %}
|
|
|
|
<div class="context" id="c{{ frame.id }}">
|
2010-12-06 22:21:51 +08:00
|
|
|
{% if frame.pre_context and not is_email %}
|
|
|
|
<ol start="{{ frame.pre_context_lineno }}" class="pre-context" id="pre{{ frame.id }}">{% for line in frame.pre_context %}<li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')"><pre>{{ line|escape }}</pre></li>{% endfor %}</ol>
|
2006-02-28 23:52:57 +08:00
|
|
|
{% endif %}
|
2010-12-06 22:21:51 +08:00
|
|
|
<ol start="{{ frame.lineno }}" class="context-line"><li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')"><pre>{{ frame.context_line|escape }}</pre>{% if not is_email %} <span>...</span>{% endif %}</li></ol>
|
|
|
|
{% if frame.post_context and not is_email %}
|
|
|
|
<ol start='{{ frame.lineno|add:"1" }}' class="post-context" id="post{{ frame.id }}">{% for line in frame.post_context %}<li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')"><pre>{{ line|escape }}</pre></li>{% endfor %}</ol>
|
2006-02-28 23:52:57 +08:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2005-11-17 11:10:03 +08:00
|
|
|
|
2006-02-28 23:52:57 +08:00
|
|
|
{% if frame.vars %}
|
|
|
|
<div class="commands">
|
2010-12-06 22:21:51 +08:00
|
|
|
{% if is_email %}
|
|
|
|
<h2>Local Vars</h2>
|
|
|
|
{% else %}
|
|
|
|
<a href="#" onclick="return varToggle(this, '{{ frame.id }}')"><span>▶</span> Local vars</a>
|
|
|
|
{% endif %}
|
2006-02-28 23:52:57 +08:00
|
|
|
</div>
|
|
|
|
<table class="vars" id="v{{ frame.id }}">
|
|
|
|
<thead>
|
2005-11-15 01:44:50 +08:00
|
|
|
<tr>
|
2006-02-28 23:52:57 +08:00
|
|
|
<th>Variable</th>
|
|
|
|
<th>Value</th>
|
2005-11-15 01:44:50 +08:00
|
|
|
</tr>
|
2006-02-28 23:52:57 +08:00
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{% for var in frame.vars|dictsort:"0" %}
|
|
|
|
<tr>
|
2010-09-11 10:02:20 +08:00
|
|
|
<td>{{ var.0|force_escape }}</td>
|
2011-01-13 21:47:03 +08:00
|
|
|
<td class="code"><pre>{{ var.1 }}</pre></td>
|
2006-02-28 23:52:57 +08:00
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
{% endif %}
|
|
|
|
</li>
|
|
|
|
{% endfor %}
|
|
|
|
</ul>
|
|
|
|
</div>
|
2007-12-02 08:00:36 +08:00
|
|
|
{% endautoescape %}
|
|
|
|
<form action="http://dpaste.com/" name="pasteform" id="pasteform" method="post">
|
2010-12-06 22:21:51 +08:00
|
|
|
{% if not is_email %}
|
2006-02-28 23:52:57 +08:00
|
|
|
<div id="pastebinTraceback" class="pastebin">
|
2007-12-04 14:39:05 +08:00
|
|
|
<input type="hidden" name="language" value="PythonConsole">
|
2010-12-06 22:21:51 +08:00
|
|
|
<input type="hidden" name="title" value="{{ exception_type|escape }}{% if request %} at {{ request.path_info|escape }}{% endif %}">
|
2007-12-04 14:39:05 +08:00
|
|
|
<input type="hidden" name="source" value="Django Dpaste Agent">
|
|
|
|
<input type="hidden" name="poster" value="Django">
|
2007-12-02 08:00:36 +08:00
|
|
|
<textarea name="content" id="traceback_area" cols="140" rows="25">
|
|
|
|
Environment:
|
|
|
|
|
2010-12-06 22:21:51 +08:00
|
|
|
{% if request %}
|
2007-12-02 08:00:36 +08:00
|
|
|
Request Method: {{ request.META.REQUEST_METHOD }}
|
2009-04-12 10:23:19 +08:00
|
|
|
Request URL: {{ request.build_absolute_uri|escape }}
|
2010-12-06 22:21:51 +08:00
|
|
|
{% endif %}
|
2007-12-02 08:00:36 +08:00
|
|
|
Django Version: {{ django_version_info }}
|
|
|
|
Python Version: {{ sys_version_info }}
|
2007-12-11 13:38:34 +08:00
|
|
|
Installed Applications:
|
2007-12-11 13:39:54 +08:00
|
|
|
{{ settings.INSTALLED_APPS|pprint }}
|
2007-12-11 13:38:34 +08:00
|
|
|
Installed Middleware:
|
2007-12-11 13:39:54 +08:00
|
|
|
{{ settings.MIDDLEWARE_CLASSES|pprint }}
|
2007-12-02 08:00:36 +08:00
|
|
|
|
|
|
|
{% 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 %}
|
2010-12-06 22:21:51 +08:00
|
|
|
Exception Type: {{ exception_type|escape }}{% if request %} at {{ request.path_info|escape }}{% endif %}
|
2010-09-11 10:02:20 +08:00
|
|
|
Exception Value: {{ exception_value|force_escape }}
|
2007-12-02 08:00:36 +08:00
|
|
|
</textarea>
|
2007-12-04 14:39:05 +08:00
|
|
|
<br><br>
|
2007-12-24 06:53:30 +08:00
|
|
|
<input type="submit" value="Share this traceback on a public Web site">
|
2006-02-28 23:52:57 +08:00
|
|
|
</div>
|
2007-12-02 08:00:36 +08:00
|
|
|
</form>
|
2005-11-15 01:44:50 +08:00
|
|
|
</div>
|
2010-12-06 22:21:51 +08:00
|
|
|
{% endif %}
|
2011-02-01 22:18:07 +08:00
|
|
|
{% endif %}
|
2005-11-15 01:44:50 +08:00
|
|
|
|
|
|
|
<div id="requestinfo">
|
|
|
|
<h2>Request information</h2>
|
2005-11-17 11:10:03 +08:00
|
|
|
|
2010-12-06 22:21:51 +08:00
|
|
|
{% if request %}
|
2005-11-15 01:44:50 +08:00
|
|
|
<h3 id="get-info">GET</h3>
|
|
|
|
{% if request.GET %}
|
|
|
|
<table class="req">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Variable</th>
|
|
|
|
<th>Value</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
2005-11-17 22:19:33 +08:00
|
|
|
<tbody>
|
2005-11-15 01:44:50 +08:00
|
|
|
{% for var in request.GET.items %}
|
|
|
|
<tr>
|
|
|
|
<td>{{ var.0 }}</td>
|
2010-12-06 22:21:51 +08:00
|
|
|
<td class="code"><pre>{{ var.1|pprint }}</pre></td>
|
2005-11-15 01:44:50 +08:00
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
{% else %}
|
2005-11-17 22:19:33 +08:00
|
|
|
<p>No GET data</p>
|
2005-11-15 01:44:50 +08:00
|
|
|
{% endif %}
|
2005-11-17 11:10:03 +08:00
|
|
|
|
2005-11-15 01:44:50 +08:00
|
|
|
<h3 id="post-info">POST</h3>
|
2011-06-09 06:18:46 +08:00
|
|
|
{% if filtered_POST %}
|
2005-11-15 01:44:50 +08:00
|
|
|
<table class="req">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Variable</th>
|
|
|
|
<th>Value</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
2005-11-17 22:19:33 +08:00
|
|
|
<tbody>
|
2011-06-09 06:18:46 +08:00
|
|
|
{% for var in filtered_POST.items %}
|
2005-11-15 01:44:50 +08:00
|
|
|
<tr>
|
|
|
|
<td>{{ var.0 }}</td>
|
2010-12-06 22:21:51 +08:00
|
|
|
<td class="code"><pre>{{ var.1|pprint }}</pre></td>
|
2005-11-15 01:44:50 +08:00
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
{% else %}
|
2005-11-17 22:19:33 +08:00
|
|
|
<p>No POST data</p>
|
2005-11-15 01:44:50 +08:00
|
|
|
{% endif %}
|
2009-04-01 01:10:06 +08:00
|
|
|
<h3 id="files-info">FILES</h3>
|
|
|
|
{% if request.FILES %}
|
|
|
|
<table class="req">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Variable</th>
|
|
|
|
<th>Value</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{% for var in request.FILES.items %}
|
|
|
|
<tr>
|
|
|
|
<td>{{ var.0 }}</td>
|
2010-12-06 22:21:51 +08:00
|
|
|
<td class="code"><pre>{{ var.1|pprint }}</pre></td>
|
2009-04-01 01:10:06 +08:00
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
{% else %}
|
|
|
|
<p>No FILES data</p>
|
|
|
|
{% endif %}
|
2009-07-21 09:50:06 +08:00
|
|
|
|
2005-11-17 11:10:03 +08:00
|
|
|
|
2005-11-15 01:44:50 +08:00
|
|
|
<h3 id="cookie-info">COOKIES</h3>
|
|
|
|
{% if request.COOKIES %}
|
|
|
|
<table class="req">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Variable</th>
|
|
|
|
<th>Value</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
2005-11-17 22:19:33 +08:00
|
|
|
<tbody>
|
2005-11-15 01:44:50 +08:00
|
|
|
{% for var in request.COOKIES.items %}
|
|
|
|
<tr>
|
|
|
|
<td>{{ var.0 }}</td>
|
2010-12-06 22:21:51 +08:00
|
|
|
<td class="code"><pre>{{ var.1|pprint }}</pre></td>
|
2005-11-15 01:44:50 +08:00
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
{% else %}
|
2005-11-17 22:19:33 +08:00
|
|
|
<p>No cookie data</p>
|
2005-11-15 01:44:50 +08:00
|
|
|
{% endif %}
|
2005-11-17 11:10:03 +08:00
|
|
|
|
2005-11-15 01:44:50 +08:00
|
|
|
<h3 id="meta-info">META</h3>
|
|
|
|
<table class="req">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Variable</th>
|
|
|
|
<th>Value</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
2005-11-17 22:19:33 +08:00
|
|
|
<tbody>
|
2005-11-15 01:44:50 +08:00
|
|
|
{% for var in request.META.items|dictsort:"0" %}
|
|
|
|
<tr>
|
|
|
|
<td>{{ var.0 }}</td>
|
2010-12-06 22:21:51 +08:00
|
|
|
<td class="code"><pre>{{ var.1|pprint }}</pre></td>
|
2005-11-15 01:44:50 +08:00
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2011-02-01 22:18:07 +08:00
|
|
|
{% else %}
|
|
|
|
<p>Request data not supplied</p>
|
2010-12-06 22:21:51 +08:00
|
|
|
{% endif %}
|
2005-11-15 01:44:50 +08:00
|
|
|
|
|
|
|
<h3 id="settings-info">Settings</h3>
|
|
|
|
<h4>Using settings module <code>{{ settings.SETTINGS_MODULE }}</code></h4>
|
|
|
|
<table class="req">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Setting</th>
|
|
|
|
<th>Value</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
2005-11-17 22:19:33 +08:00
|
|
|
<tbody>
|
2005-11-15 01:44:50 +08:00
|
|
|
{% for var in settings.items|dictsort:"0" %}
|
|
|
|
<tr>
|
|
|
|
<td>{{ var.0 }}</td>
|
2010-12-06 22:21:51 +08:00
|
|
|
<td class="code"><pre>{{ var.1|pprint }}</pre></td>
|
2005-11-15 01:44:50 +08:00
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
</div>
|
2011-03-14 22:58:54 +08:00
|
|
|
{% if not is_email %}
|
|
|
|
<div id="explanation">
|
|
|
|
<p>
|
|
|
|
You're seeing this error because you have <code>DEBUG = True</code> in your
|
|
|
|
Django settings file. Change that to <code>False</code>, and Django will
|
|
|
|
display a standard 500 page.
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2005-11-15 01:44:50 +08:00
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
"""
|
|
|
|
|
2011-10-02 10:53:58 +08:00
|
|
|
TECHNICAL_500_TEXT_TEMPLATE = """{% firstof exception_type 'Report' %}{% if request %} at {{ request.path_info }}{% endif %}
|
|
|
|
{% firstof exception_value 'No exception supplied' %}
|
|
|
|
{% if request %}
|
|
|
|
Request Method: {{ request.META.REQUEST_METHOD }}
|
|
|
|
Request URL: {{ request.build_absolute_uri }}{% endif %}
|
|
|
|
Django Version: {{ django_version_info }}
|
|
|
|
Python Executable: {{ sys_executable }}
|
|
|
|
Python Version: {{ sys_version_info }}
|
|
|
|
Python Path: {{ sys_path }}
|
|
|
|
Server time: {{server_time|date:"r"}}
|
|
|
|
Installed Applications:
|
|
|
|
{{ settings.INSTALLED_APPS|pprint }}
|
|
|
|
Installed Middleware:
|
|
|
|
{{ settings.MIDDLEWARE_CLASSES|pprint }}
|
|
|
|
{% 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 %}{% if frames %}
|
|
|
|
Traceback:
|
|
|
|
{% for frame in frames %}File "{{ frame.filename }}" in {{ frame.function }}
|
|
|
|
{% if frame.context_line %} {{ frame.lineno }}. {{ frame.context_line }}{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
{% if exception_type %}Exception Type: {{ exception_type }}{% if request %} at {{ request.path_info }}{% endif %}
|
|
|
|
{% if exception_value %}Exception Value: {{ exception_value }}{% endif %}{% endif %}{% endif %}
|
|
|
|
{% if request %}Request information:
|
|
|
|
GET:{% for k, v in request.GET.items %}
|
|
|
|
{{ k }} = {{ v|stringformat:"r" }}{% empty %} No GET data{% endfor %}
|
|
|
|
|
|
|
|
POST:{% for k, v in filtered_POST.items %}
|
|
|
|
{{ k }} = {{ v|stringformat:"r" }}{% empty %} No POST data{% endfor %}
|
|
|
|
|
|
|
|
FILES:{% for k, v in request.FILES.items %}
|
|
|
|
{{ k }} = {{ v|stringformat:"r" }}{% empty %} No FILES data{% endfor %}
|
|
|
|
|
|
|
|
COOKIES:{% for k, v in request.COOKIES.items %}
|
|
|
|
{{ k }} = {{ v|stringformat:"r" }}{% empty %} No cookie data{% endfor %}
|
|
|
|
|
|
|
|
META:{% for k, v in request.META.items|dictsort:"0" %}
|
|
|
|
{{ k }} = {{ v|stringformat:"r" }}{% endfor %}
|
|
|
|
{% else %}Request data not supplied
|
|
|
|
{% endif %}
|
|
|
|
Settings:
|
|
|
|
Using settings module {{ settings.SETTINGS_MODULE }}{% for k, v in settings.items|dictsort:"0" %}
|
|
|
|
{{ k }} = {{ v|stringformat:"r" }}{% 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.
|
|
|
|
"""
|
|
|
|
|
2005-11-15 01:44:50 +08:00
|
|
|
TECHNICAL_404_TEMPLATE = """
|
2011-04-21 01:40:53 +08:00
|
|
|
<!DOCTYPE html>
|
2005-11-15 01:44:50 +08:00
|
|
|
<html lang="en">
|
|
|
|
<head>
|
2007-12-04 14:39:05 +08:00
|
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
2008-08-28 03:59:29 +08:00
|
|
|
<title>Page not found at {{ request.path_info|escape }}</title>
|
2007-12-04 14:39:05 +08:00
|
|
|
<meta name="robots" content="NONE,NOARCHIVE">
|
2005-11-15 01:44:50 +08:00
|
|
|
<style type="text/css">
|
|
|
|
html * { padding:0; margin:0; }
|
|
|
|
body * { padding:10px 20px; }
|
|
|
|
body * * { padding:0; }
|
|
|
|
body { font:small sans-serif; background:#eee; }
|
|
|
|
body>div { border-bottom:1px solid #ddd; }
|
|
|
|
h1 { font-weight:normal; margin-bottom:.4em; }
|
|
|
|
h1 span { font-size:60%; color:#666; font-weight:normal; }
|
|
|
|
table { border:none; border-collapse: collapse; width:100%; }
|
|
|
|
td, th { vertical-align:top; padding:2px 3px; }
|
|
|
|
th { width:12em; text-align:right; color:#666; padding-right:.5em; }
|
|
|
|
#info { background:#f6f6f6; }
|
|
|
|
#info ol { margin: 0.5em 4em; }
|
|
|
|
#info ol li { font-family: monospace; }
|
|
|
|
#summary { background: #ffc; }
|
|
|
|
#explanation { background:#eee; border-bottom: 0px none; }
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="summary">
|
|
|
|
<h1>Page not found <span>(404)</span></h1>
|
|
|
|
<table class="meta">
|
|
|
|
<tr>
|
|
|
|
<th>Request Method:</th>
|
|
|
|
<td>{{ request.META.REQUEST_METHOD }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th>Request URL:</th>
|
2009-04-12 10:23:19 +08:00
|
|
|
<td>{{ request.build_absolute_uri|escape }}</td>
|
2005-11-15 01:44:50 +08:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<div id="info">
|
2005-12-07 14:02:09 +08:00
|
|
|
{% if urlpatterns %}
|
|
|
|
<p>
|
2010-12-13 06:54:04 +08:00
|
|
|
Using the URLconf defined in <code>{{ urlconf }}</code>,
|
2005-12-07 14:02:09 +08:00
|
|
|
Django tried these URL patterns, in this order:
|
|
|
|
</p>
|
|
|
|
<ol>
|
|
|
|
{% for pattern in urlpatterns %}
|
2010-09-13 03:27:33 +08:00
|
|
|
<li>
|
|
|
|
{% for pat in pattern %}
|
|
|
|
{{ pat.regex.pattern }}
|
|
|
|
{% if forloop.last and pat.name %}[name='{{ pat.name }}']{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
</li>
|
2005-12-07 14:02:09 +08:00
|
|
|
{% endfor %}
|
|
|
|
</ol>
|
2007-04-09 09:10:26 +08:00
|
|
|
<p>The current URL, <code>{{ request_path|escape }}</code>, didn't match any of these.</p>
|
2005-12-06 13:04:56 +08:00
|
|
|
{% else %}
|
2007-11-14 20:58:53 +08:00
|
|
|
<p>{{ reason }}</p>
|
2005-11-15 01:44:50 +08:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
2005-11-17 11:10:03 +08:00
|
|
|
|
2005-11-15 01:44:50 +08:00
|
|
|
<div id="explanation">
|
|
|
|
<p>
|
|
|
|
You're seeing this error because you have <code>DEBUG = True</code> in
|
|
|
|
your Django settings file. Change that to <code>False</code>, and Django
|
|
|
|
will display a standard 404 page.
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|
2005-11-24 08:06:36 +08:00
|
|
|
"""
|
2005-12-07 14:02:09 +08:00
|
|
|
|
|
|
|
EMPTY_URLCONF_TEMPLATE = """
|
2011-04-21 01:40:53 +08:00
|
|
|
<!DOCTYPE html>
|
2005-12-07 14:02:09 +08:00
|
|
|
<html lang="en"><head>
|
|
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
|
|
|
<meta name="robots" content="NONE,NOARCHIVE"><title>Welcome to Django</title>
|
|
|
|
<style type="text/css">
|
|
|
|
html * { padding:0; margin:0; }
|
|
|
|
body * { padding:10px 20px; }
|
|
|
|
body * * { padding:0; }
|
|
|
|
body { font:small sans-serif; }
|
|
|
|
body>div { border-bottom:1px solid #ddd; }
|
|
|
|
h1 { font-weight:normal; }
|
|
|
|
h2 { margin-bottom:.8em; }
|
|
|
|
h2 span { font-size:80%; color:#666; font-weight:normal; }
|
|
|
|
h3 { margin:1em 0 .5em 0; }
|
|
|
|
h4 { margin:0 0 .5em 0; font-weight: normal; }
|
|
|
|
table { border:1px solid #ccc; border-collapse: collapse; width:100%; background:white; }
|
|
|
|
tbody td, tbody th { vertical-align:top; padding:2px 3px; }
|
|
|
|
thead th { padding:1px 6px 1px 3px; background:#fefefe; text-align:left; font-weight:normal; font-size:11px; border:1px solid #ddd; }
|
|
|
|
tbody th { width:12em; text-align:right; color:#666; padding-right:.5em; }
|
|
|
|
ul { margin-left: 2em; margin-top: 1em; }
|
|
|
|
#summary { background: #e0ebff; }
|
|
|
|
#summary h2 { font-weight: normal; color: #666; }
|
|
|
|
#explanation { background:#eee; }
|
|
|
|
#instructions { background:#f6f6f6; }
|
|
|
|
#summary table { border:none; background:transparent; }
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<div id="summary">
|
|
|
|
<h1>It worked!</h1>
|
|
|
|
<h2>Congratulations on your first Django-powered page.</h2>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="instructions">
|
|
|
|
<p>Of course, you haven't actually done any work yet. Here's what to do next:</p>
|
|
|
|
<ul>
|
2009-12-22 23:18:51 +08:00
|
|
|
<li>If you plan to use a database, edit the <code>DATABASES</code> setting in <code>{{ project_name }}/settings.py</code>.</li>
|
2012-01-02 05:54:33 +08:00
|
|
|
<li>Start your first app by running <code>python manage.py startapp [appname]</code>.</li>
|
2005-12-07 14:02:09 +08:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="explanation">
|
|
|
|
<p>
|
|
|
|
You're seeing this message because you have <code>DEBUG = True</code> in your
|
|
|
|
Django settings file and you haven't configured any URLs. Get to work!
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</body></html>
|
|
|
|
"""
|