Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Outputting errors to browser in CherryPy

I am new to cherrypy, and can't seem to figure out how to have cherrypy emit a stacktrace or error message to my browser when an error occurs.

I am running cherrypy on apache with mod_wsgi, so its particularly annoying to dig through the apache error logs during development.

I am used to PHP, where errors are nicely output to the browser when your script crashes. It is a useful feature when debugging. How does one do this in CherryPy?

This section on logging in CherryPy doesn't seem to cover that, unless I'm missing something obvious.

like image 588
Jesse Cohen Avatar asked Dec 29 '22 01:12

Jesse Cohen


1 Answers

The most important config setting which governs tracebacks in the browser is request.show_tracebacks. Set it to True to get tracebacks. Note that using the "production" config environment sets this to False. There may be other WSGI components you're using, or some feature of mod_wsgi or Apache which is also getting in the way, but I can't speak to those.

like image 77
fumanchu Avatar answered Jan 05 '23 15:01

fumanchu