Google App Engine is based on Python. The best IDE for Python is Eclipse with the
Pydev plugin. You can run
dev_appserver.py in debug mode, set break points, inspect variables, and evaluate expressions in the context of the breakpoint. To setup your appengine project in Pydev, first create a new Pydev project. Choose Python 2.5 and uncheck the option to create a source folder named 'src'. Create two source folders, one named "test" and the other the name of your project. Having a separate source folder for tests is a good idea, because that way when you run
appcfg.py update you won't upload your tests to the production server. Giving your main source folder the same name as your project is a good idea, because it makes the appcfg.py update command explicit about which project you are updating.
In order to debug dev_appserver.py you need to add a source folder for the appengine source and its three libraries. In Eclipse create a new folder (not a source folder), and click the Advanced button. Check the box for linking to an existing folder and use the Browse button to choose you appengine source directory (on Windows it is typically C:\Program Files\Google\google_appengine). Now right click on the new folder and choose add as source folder. Then navigate to the following three folders and add them as source folders:
- lib/django
- lib/webbob
- lib/yaml/lib
Now right click on dev_appserver.py and select Run as Python application. You will see the help message printed in the console. Open the Run... dialog. Set the program arguments to '-c
'. The -c option clears your local datastore on each startup. Set the working directory to your Eclipse project root (the parent directory of your main source folder). Now you can click debug and the server will startup. Be sure to setup Eclipse so it launches the previously launched application, because you will be working in your source code
but you will want to launch dev_appserver.py. This setting is in Preferences>Run/Debug>Launching. You will probably notice a warning message printed in the console that says Psyco is not installed. Install it, it takes 5 seconds.
This is the setup I use to develop my app engine apps, volt.appspot.com and etapic.name, and I am very happy with it.
No comments:
Post a Comment