Using Wing with Plone

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

"The best solution for debugging Zope and Plone" -- Joel Burton, Member, Plone Team

Wing is a Python IDE that can be used to develop, test, and debug Python code written for the Plone content management system. 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.


The instructions below are for the Plone 4 unified installer. If you are using an older version of Plone or use a source installation of Plone 4 that makes use of old style Products name space merging, please refer instead to the instructions for Using Wing with Zope.

Note: We strongly discourage running Wing or development instances of Plone as root or administrator. This creates unnecessary security risks and will cause debugger configuration problems.

Configuring your Project

To set up your project, simply set the Main Debug File in Project Properties to the file zinstance/bin/instance within your Plone installation. This may instead be zeocluster/bin/client1 with a ZEO install, or whatever name is given in the .cfg file. Wing will read the sys.path updates from that file so that it can find your Plone modules.

You may also need to set Python Executable in Project Properties (accessed from the Project menu) to the Python that is used in your Plone instance. For example, in a standalone install this may be Python2.6/bin/python or similar. The full path can be found by looking at the top of many of the scripts in zinstance/bin or zeocluster/bin.

For Plone 4, do not use the Zope2 support in Project Properties under the Extensions tab. This is not needed unless your Plone installation still uses old style Product name space merging.

Debugging with WingDBG

There are two ways to configure debugging. The method described in this sub-section uses a Zope control panel to turn debugging on and off and will debug only requests to a particular debug port. This is the most common way in which Plone is debugged with Wing.

To get debugging working install WingDBG, the Wing debugger product, from zope/WingDBG-6.0.4.tar in your Wing installation by unpacking it into zinstance/products (or zeocluster/products in a zeo install).

Then edit your etc/zope.conf to change enable-product-installation off at the end to instead read enable-product-installation on. In a zeo install this file is located at zeocluster/parts/client1/etc/zope.conf.

Finally, click on the bug icon in the lower left of the IDE window and turn on Accept Debug Connections so the debugger listens for connections initiated from the outside.

Then start Plone and go into the Zope Management Interface from http://localhost:8080/ , click on Control Panel, and then on Wing Debug Service at the bottom. From here you can turn on debugging. The bug icon in lower left of Wing's window should turn green after a while and then any page loads via port 50080 (http://localhost:50080/) will be debugged and will reach breakpoints. This port and other debugger options are configurable from the WingDBG control panel.

WingDBG in buildout-based Plone installations

In some new buildout-based Plone settings, WingDBG will not load until the buildout.cfg (generated by the template plone4_buildout) is edited to add the following just above [zopepy]:

products = ${buildout:directory}/products

Then rerun bin/buildout -N which will add a line like the following to your parts/instance/etc/zope.conf file:

products /path/to/your/products''

You will also need to add the specified products directory manually, and then place WingDBG in it.

WingDBG as an Egg

Encolpe Degoute has been maintaining a version of WingDBG that is packaged as an egg.

Creating an egg yourself is also possible as follows:

paster create -t plone Products.WingDBG

Then copy WingDBG/* to Products.WingDBG/Products/WingDBG.

Debugging Plone from the IDE

It is also possible to debug Plone without WingDBG by launching Plone directly from the IDE. This technique may be more convenient in some cases, and debugs all requests to the Plone instance (not just those on a special debug port).

To debug this way, set zinstance/bin/instance (or zeocluster/bin/client1 in a zeo install) in your Plone installation as the Main Debug File in Project Properties (this should already be done from configuring your project earlier). Then right click on the file in the editor or Project view, select Properties, and set Run Arguments under the Debug tab to common.

Note that this solution can take more time to launch than debugging with WingDBG since the entire startup process is debugged.

Related Documents

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