Latest Version: 0.9.6.2
  Dashboard > Pylons Cookbook > ... > Troubleshooting > Exploring Pylons with the WingIDE debugger
  Pylons Cookbook Log In | Sign Up   View a printable version of the current page.  
  Exploring Pylons with the WingIDE debugger
Added by Christoph Haas, last edited by Christoph Haas on May 30, 2007
Labels: 
(None)

Exploring Pylons with the WingIDE debugger

Mike Orr documented what actually happens when running the QuickWiki tutorial's application in his article called Pylons Execution Analysis. However if you feel you like to relive the magic of the birth of a Pylons application and have a version of the WingIDE at your fingertips then you can use its debugger to explore what happens.

  • Choose Project -> New Project
  • Choose Project -> Properties
  • Select the Debug tab
  • Set the Initial Directory to Custom and enter the path where your development.ini is located
  • In the Project pane (by default in the upper right corner) right-click and select Add Directory Tree and select the same path as before
  • Right-click again here and choose Add File. Add the /usr/bin/paster file (or wherever it is on your computer)
  • Right-click on the paster file and choose Set As Main Debug File
  • Open your config/middleware.py file from the Project pane
  • In the middleware.py set a breakpoint at the "def make_app()" by pressing F9
  • Start the debugger (F5)
  • Click on the Debug tab
  • Enter "serve development.ini" as Run Arguments
  • Click OK

After a few seconds you will see the make_app being highlighted and the breakpoint was reached. You can now step through the application step-by-step to see what's happening.

(I have not been successful in setting working breakpoints in the controllers. Suggestions welcome.)

To set working breakpoints in a controller do the following:

  • Add the statement "import wingdbstub" at the beginning of the controller.
  • Set a breakpoint somewhere within the controller and configure WingIDE to listen for debugger connections.
  • Start the Pylons application from a command line (not from within WingIDE) via the normal mechanism, i.e. paster serve development.ini.
  • Navigate with a browser to a URL handled by the controller.
  • When the controller executes, a connection to the WingIDE debugger will be established and the breakpoint should fire.

I have only been able to get this to work for a single request. The breakpoint does not fire for subsequent requests. To enable that you need to shut down and restart the paster serve session for each request that requires debugging.

Posted by David Mellor at Nov 14, 2007 21:16 | Permalink
Site running on a free Atlassian Confluence Open Source Project License granted to Pylons. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.3.3 Build:#645 Feb 13, 2007) - Bug/feature request - Contact Administrators
Top