Using Wing with mod_wsgi

Index of All Documentation » How-Tos » How-Tos for Web Development »


Wing is a Python IDE that can be used to develop, test, and debug Python code that is running under mod_wsgi. Two versions of Wing are appropriate for use with this document: Wing Pro is the full-featured Python IDE for professional programmers, and Wing Personal is a free alternative with reduced feature set.

If you do not already have Wing installed, download it now.

To get started using Wing, refer to the tutorial in the Help menu in Wing or the Quickstart Guide.

Debugging Setup

When debugging Python code running under mod_wsgi, the debug process is initiated from outside of Wing, and must connect to the IDE. This is done with wingdbstub according to the instructions in the Debugging Externally Launched Code section of the manual.

Because of how mod_wsqi sets up the interpreter, be sure to set kEmbedded=1 in your copy of wingdbstub.py and use the debugger API to reset the debugger and connection as follows:

import wingdbstub
wingdbstub.Ensure()

Then click on the bug icon in lower left of Wing's window and make sure that Accept Debug Connections is checked. After that, you should be able to reach breakpoints by loading pages in your browser.

Disabling stdin/stdout Restrictions

In order to debug, may also need to disable the WSGI restrictions on stdin/stdout with the following mod_wsgi configuration directives:

WSGIRestrictStdin Off
WSGIRestrictStdout Off

Related Documents

Wing provides many other options and tools. For more information: