我需要重定向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,對不起!」錯誤。 –