我们正在尝试设置gunicorn + plone。到目前为止它运行良好,但无法处理错误(404,500等)并抛出'内部服务器错误',而它应该返回plone的错误页面。
下面粘贴请求不存在的页面的示例。问题是如何设置gunicorn以便像其他请求一样由zope / plone自己处理错误?
干杯和问候
==> var/log/gunicorn-stdout---supervisor-JhaTfg.log <==
2012-05-24 01:41:16 [15137] [ERROR] Error handling request
Traceback (most recent call last):
File "/home/user/testing/eggs/gunicorn-0.14.3-py2.6.egg/gunicorn/workers/sync.py", line 100, in handle_request
respiter = self.wsgi(environ, resp.start_response)
File "/home/user/testing/eggs/repoze.retry-1.0-py2.6.egg/repoze/retry/__init__.py", line 90, in __call__
app_iter = self.application(environ, replace_start_response)
File "/home/user/testing/eggs/repoze.tm2-1.0b2-py2.6.egg/repoze/tm/__init__.py", line 24, in __call__
result = self.application(environ, save_status_and_headers)
File "/home/user/testing/eggs/repoze.vhm-0.14-py2.6.egg/repoze/vhm/middleware.py", line 106, in __call__
return self.application(environ, start_response)
File "/home/user/testing/eggs/Zope2-2.13.13-py2.6.egg/ZPublisher/WSGIPublisher.py", line 255, in publish_module
response = _publish(request, 'Zope2')
File "/home/user/testing/eggs/Zope2-2.13.13-py2.6.egg/ZPublisher/WSGIPublisher.py", line 185, in publish
object = request.traverse(path, validated_hook=validated_hook)
File "/home/user/testing/eggs/Zope2-2.13.13-py2.6.egg/ZPublisher/BaseRequest.py", line 518, in traverse
return response.notFoundError(URL)
File "/home/user/testing/eggs/Zope2-2.13.13-py2.6.egg/ZPublisher/HTTPResponse.py", line 718, in notFoundError
"<p><b>Resource:</b> %s</p>" % escape(entry))
NotFound: <h2>Site Error</h2>
<p>An error was encountered while publishing this resource.
</p>
答案 0 :(得分:0)
关于我的问题,我忘了提到我们正在使用WSGI Zope和gunicorn。
在我们的场景中,我们修补了ZPublisher / WSGIPublisher.py以正确处理NotFound异常(404),而不是抛出500内部服务器错误。
事实证明,Zope + Wsgi仍然不那么成熟(至少在错误处理方面)。