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:
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.