Wednesday, May 23, 2012

gunicorn + zope error handling

we are trying to setup gunicorn + plone. It works well so far, but fails to handle errors (404, 500 etc) and throws 'Internal Server Error' while it should return plone's error page.



Example case of requesting a page that doesn't exist is pasted below. The question is how should gunicorn be setup so that errors are handled themselves by zope/plone, as other requests?



Cheers and regards



==> 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>




No comments:

Post a Comment