我想写一个中间件,因为否则该异常在500.html中不可用
http://docs.djangoproject.com/en/dev/topics/http/middleware/#process-
exception
class ProcessExceptionMiddleware(object): def process_exception(self, request, exception): t = Template("500 Error: {{ exception }}") response_html = t.render(Context({'exception' : exception })) response = http.HttpResponse(response_html) response.status_pre = 500 return response


