Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to debug CherryPy applications?

I've seen this question posted here before but I want to get a final yes/no on this.

I've been trying to debug my app using Netbeans 6.8 (no luck at all) and the newly released Netbeans 6.9 (notices that code has been called but fails to stop the code from executing).

Is it possible to debug CherryPy applications?

like image 373
OrganicPanda Avatar asked Jun 29 '10 09:06

OrganicPanda


1 Answers

I use breakpoints in cherrypy all the time in Wing IDE (3.x). I should mentions that I don't debug when the application is hosted through a webserver. I run the application using cherrypy's build in webserver, using my CPython interpreter installed on the machine.

The code looks something like this:

# main.py

# ...snip...

if __name__ == '__main__':

    # Handle configuration settings, calling cherrypy.tree.mount in the process
    generate_app(options.environment)

    # Run the web server
    engine = cherrypy.engine
    try:
        engine.start()
    except:
        sys.exit(1)
    else:
        engine.block()

Then, in Wing IDE, I put a break point somewhere (say in one of my controllers) and then run main.py through the IDE. Pointing a browser at the url of the controller will cause the breakpoint to trigger.

Hope that information was helpful.

like image 66
Eric Palakovich Carr Avatar answered Oct 04 '22 10:10

Eric Palakovich Carr