我需要重定向Django的进口错误'自定义错误page.All除了导入错误其他错误是redrecting到自定义错误页的Django如何蟒蛇导入错误重定向到自定义错误页
早在DEBUG =假在浏览器中显示 错误是
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/django/core/servers/basehttp.py", line 283, in run
self.result = application(self.environ, self.start_response)
File "/usr/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 272, in __call__
response = self.get_response(request)
File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 169, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 214, in handle_uncaught_exception
if resolver.urlconf_module is None:
File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 274, in _get_urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/project/backup/project/hg/rel0129/hg/src/customer_/../customer_/hg/urls.py", line 4, in <module>
from lostpassword.views import recaptcha, reset
File "/project/backup/project/hg/rel0129/hg/../customer_/hg/lostpassword/views.py", line 12, in <module>
from hg.utils.common import __render, __redirect
hg/utils/common.py", line 15, in <module>
from urllibwrapper import URLClient, ClientResponse
ImportError: No module named urlwrapper
错误必须重定向到自定义错误页
在此先感谢
'404'没有找到页面。理想情况下,你想'500'(或服务器错误)。你为什么指定一个'404'? – Ewan
我的意思是自定义错误页面或django默认错误模板。 –
导入异常是编程错误,而不是“正确的服务器,错误的URL,对不起!”错误。 –