Using Wing with Google App Engine

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 written for Google App Engine. Wing provides auto-completion, call tips, a powerful debugger, and many other features that help you write, navigate, and understand Python code.

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.

This document describes how to configure Wing for Google App Engine. To get started using Wing as your Python IDE, please refer to the tutorial in Wing's Help menu or read the Quickstart Guide.

Creating a Project

Before trying to configure a Wing project, first install and set up Google App Engine and verify that it is working by starting it outside of Wing and testing it with a web browser. It is also a good idea to install App Engine upgrades at this time, before doing anything else.

Then create a project in Wing using New Project in the Project menu and selecting Google App Engine as the project type. Then use Add Directory in the Project menu to add your source directories to the project. You should also add at least, which is located in the top level of the Google SDK directory.

Next open up in Wing's editor and select Set Current as Main Debug File in the Debug menu. This tells Wing to use this file as the main entry point, which is then highlighted in red in the Project tool. If a main debug file is already defined the Debug menu item will be Clear Main Debug File instead.

Next you need to go into Project Properties and set Debug/Execute > Debug Child Processes to Always Debug Child Processes. This is needed because App Engine creates more than one process.

Finally, save your project with Save Project in the Project menu. Store the project at or near the top level of your source tree.

Configuring the Debugger

Before trying to debug make sure you stop Google App Engine if it is running already outside of Wing.

You can debug code running under Google App Engine by selecting Start / Continue from the Debug menu (or using the green run icon in the toolbar). This will bring up a dialog that contains a Run Arguments field that must be altered to specify the application to run. For example, to run the guestbook demo that comes with the SDK, the run arguments would be "${GOOGLE_APPENGINE_DIR}/demos/guestbook" where ${GOOGLE_APPENGINE_DIR} is replaced by the full pathname of the directory the SDK is installed in. The quotation marks are needed if the pathname contains a space. In other apps, this is the directory path to where the app.yaml file is located. If this path name is incorrect, you will get an error when you start debugging.

You can also leave the environment reference ${GOOGLE_APPENGINE_DIR} in the path and define an environment variable under the Environment tab of the Debug dialog. Or use ${WING:PROJECT_DIR} instead to base the path on the directory where the project file is located.

For most projects, you'll need to add at least --max_module_instances=1 to the run arguments, and you may also want to add --threadsafe_override=false. These command line arguments disable some of GAE's threading and concurrency features that can prevent debugging from working properly.

Add a --port=8082 style argument if you wish to change the port number that Google App Engine is using when run from Wing's debugger. Otherwise the default of 8080 will be used.

Using a partial path for the application may also be possible if the Initial Directory is also set in under the Debug tab.

Next, click the OK button to start debugging. Once the debugger is started, the Debug I/O tool (accessed from the Tools menu) should display output from App Engine, and this should include a message indicating the hostname and port at which App Engine is taking requests. Requests may be made with a web browser using that URL. If Google App Engine asks to check for updates at startup, it will do so in the Debug I/O tool and you can press "y" or "n" and then Enter as you would on the command line. Or send the --skip_sdk_update_check argument on the command line to to disable this.

Using the Debugger

After you have configured the debugger, set a break point in any Python code that is executed by a request and load the page in the browser. For example, to break when the main page of the guestbook demo is generated, set a breakpoint in the method Mainpage.get in When you reach the breakpoint, the browser will sit and wait while Wing displays a red run marker on code at the breakpoint and other lines as you step through code using the buttons in Wing's toolbar.

Check out the Stack Data and Watch tools in the Tools menu to inspect debug data, or just use the Debug Probe, which is an interactive Python shell that works in the context of the current debug stack frame. When the debug process is paused, both the Debug Probe and editor show auto-completion and call tips based on live runtime state, making it quick and easy to write and try out new code. You can also see data values by hovering the mouse over symbols in the editor or Debug Probe and you can press F4 to go to the point of definition.

Continuing with the green run button in the toolbar will complete the page load in the browser, unless a breakpoint or exception is reached first.

To set up multiple entry points, use Named Entry Points in the Debug menu. These can contain different commands lines and environment for

You may edit the Python code for an application while the App Engine is running, and then reload in your browser to see the result of any changes made. In most cases, there is no need to restart the debug process after edits are made. However, if you try the browser reload too quickly, while App Engine is still restarting, then it may not respond or breakpoints may be missed.

To learn more about the debugger, try the Tutorial in Wing's Help menu.

Improving Auto-Completion and Goto-Definition

Wing can't parse the sys.path hackery in more recent versions of Google App Engine so it may fail to find some modules for auto-completion, goto-definition and other features. To work around this, set a breakpoint in _run_file in and start debugging. Then, after script_name has been set, in the Debug Probe tool (in Wing Pro only) type the following:


Copy this to the clipboard and open up the file properties for by right-clicking on the file. Then, in Project Properties under the Environment tab select Custom for the Python Path, click on the View as Text button and paste in the extra path.

You will need to redo this if you move the app engine installation, or you can use ${WING:PROJECT_DIR} to convert those paths to base on the location of the project file.

If you use more than one app within your project with multiple Named Entry Points, you'll want to set this Python Path into the Named Entry Points's Launch Configuration environment instead of placing it in Project Properties.


App Engine runs code in a secure environment that prevents access to some system information, including process ID. This causes some of the sub-processes created by App Engine to be shown with process id -1. In this case they are not listed as children of the parent process and you will need to kill both processes, one at a time, from the toolbar or Debug menu.

Windows users may need to set the TZ environment variable to UTC via the environment field in Project Properties to work around problems with setting os.environ['TZ'] while a process is running (this is a Windows runtime bug). One possible symptom of this is repeated 302 redirects that prevent logging in or other use of the site.

The Debugger > Exceptions > Report Exceptions preference should be set to When Printed (the default) when working with Google App Engine or Wing will report some additional exceptions that are handled internally when running Google App Engine outside of the debugger.

If you have unchecked the "Show this dialog before each run" checkbox in the debug dialog shown when launching and need to alter the command line arguments or other values there, you can access the dialog by right clicking on in the editor or Project and selecting Properties.

Related Documents

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