2012-05-23 3 views
2

우리는 gunicorn + plone을 설정하려고합니다. 그것은 지금까지는 잘 작동하지만 오류 (404, 500 등)를 처리하지 못하고 '내부 서버 오류'를 throw하지만 plone의 오류 페이지를 반환해야합니다.gunicorn + zope 오류 처리

존재하지 않는 페이지를 요청한 경우 아래에 붙여 넣습니다. 질문은 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

내 질문에 나는 우리가 WSGI 조프와 gunicorn을 사용하고 있는지 얘기를 깜빡 했네요.

이 시나리오에서는 500 내부 서버 오류를 throw하는 대신 NotFound 예외 (404)를 올바르게 처리하도록 ZPublisher/WSGIPublisher.py를 패치했습니다.

Zope + Wsgi는 여전히 성숙하지 않습니다 (적어도 오류 처리시).

+0

답변을 추가하는 대신 질문을 편집 할 수 있어야합니다. – Claudiu