- Wing IDE Tutorial
- How-Tos
- Wing IDE Reference Manual
- Python Documentation
- Mailing Lists and Blogs
- Priority Support
- Wing IDE beta release
Follow Wingware:
On FacebookOn LinkedIn
On Twitter
On Reddit.com
On Freshmeat.net
Our Blog
Home » Support » Index of All Documentation » How-Tos » How-Tos for Web Development »
4.4. Using Wing IDE with the Google App Engine

Wing IDE is an integrated development environment that can be used to write, test, and debug Python code that is written for the 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. Since Google App Engine will reload your code when you save it to disk, you can achieve a very fast edit/debug cycle without restarting the debug process.
For more information on Wing IDE see the product overview. If you do not already have Wing IDE installed, download a free trial now. To get started using Wing, refer to the tutorial in the Help menu in Wing and/or the Wing IDE Quickstart Guide.
In order to debug Google App Engine applications, you will need Wing 3.1 beta3 or later, since earlier versions were missing some important functionality.
Configuring the Environment
In order for Wing to be able to work with Google App Engine code, you will need to create a project in Wing and set the main debug file to the dev_appserver.py located in the top level of the Google SDK directory. This is done with the Set Main Debug File item in the Debug menu.
Debugging Your Application
You can debug code running under the Google App Engine by selecting Start / Continue from the Debug menu (or use the run icon in the toolbar) and then specifying your application's directory as the run argument. For example, to run the guestbook demo that comes with the SDK, the run argument 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 or an environment variable is set up with the pathname (or use ${WING:PROJECT_DIR} to base the path on the directory where the project file is located). The quotation marks are needed if the pathname contains a space.
Once the debugger is started, requests may be made with a web browser and breakpoints may be set in any Python file. For example, to break when the main page of the guestbook demo is generated, set a breakpoint in the method Mainpage.get in guestbook.py. You may edit the Python code for an application while the App Engine is running, and then reload to see the changes. In most cases, there is no need to start the debug process after edits.
Note that 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.
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 fix_sys_path in dev_appserver.py and start debugging. Then, in the Debug Probe tool (in Wing Pro only) type the following:
os.pathsep.join(EXTRA_PATHS)
Copy this to the clipboard and open up the file properties for dev_appserver.py by right-clicking on the file. Then, 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.
Improving Responsiveness when Setting Breakpoints or Pausing
Out of the box, Google App Engine will sit in a select call for up to thirty seconds when it has nothing to do. This results in delays in setting breakpoints or pausing the debug process. To speed this up, go into tools/dev_appserver.py and change DEFAULT_SELECT_DELAY to a shorter value, such as 1.0.
Fixing Debug Probe
The Debug Probe in Wing requires a few modules that some older versions of Google App Engine (for example 1.2.4) omit. This seems to be fixed in versions 1.2.8 and later.
If you run into this problem, you can fix the Debug Probe to work properly by changing code in dev_appserver.py (the copy located in the google/appengine/tools sub-directory, not the one at the top level) to include the __builtin__ and imp modules in those that are included. In version 1.2.4, this is on line 623 where the code should then read:
if (module_name in ('codecs', 'encodings', '__builtin__', 'imp') or
The necessary changes may vary in other versions of Google App Engine.
Using Django
If you are using the Django via the app-engine-patch project, you need to use manage.py as your main debug file instead of dev_appserver.py and should follow the instructions in the Django How-To (except that the --noreload option is not supported). In particular, note the need to ignore the NameError exception at startup.
Related Documents
Wing IDE provides many other options and tools. For more information:
- Wing IDE Reference Manual, which describes Wing IDE in detail.
- Google App Engine home page, which provides links to documentation.
- Wing IDE Quickstart Guide which contains additional basic information about getting started with Wing IDE.
| « 4.3. Using Wing IDE with Plone | Table of Contents | 4.5. Using Wing IDE with web2py » |
