开发者

CherryPy changes my response code

In my python application using mod_wsgi and cherrypy ontop of Apache my response code get changed to开发者_如何学C a 500 from a 403. I am explicitly setting this to 403.

i.e. cherrypy.response.status = 403

I do not understand where and why the response code that the client receives is 500. Does anyone have any experience with this problem>


The HTTP 500 error is used for internal server errors. Something in the server or your application is likely throwing an exception, so no matter what you set the response code to be before this, CherryPy will send a 500 back.

You can look into whatever tools CherryPy includes for debugging or logging (I'm not familiar with them). You can also set breakpoints into your code and continue stepping into the CherryPy internals until it hits the error case.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜