Donnerstag, 10. April 2008

Google App Engine & eclipse (PyDev)

updated (Link to youtube video) thanks to mano marks.
updated (Python debugging) thanks to mkielar.

updated (CC-by license).

Update: If you like following a video more than reading some text, Mano Marks from Google created a screencast about how to get started with App Engine.

Since Google published their App Engine, I am highly interested in it. Too bad I didn't get an App Engine account, but at least I am able to test it locally...
As a fan of eclipse and being new to Python development, I searched for an eclipse Python extension and finally found PyDev sourceforge project.
I know this is basic stuff, but it took me some minutes to find out how to get code completion working with Google App Engine.
So here is a small HowTo for getting App Engine with eclipse and PyDev up and running:

  1. Get Python and install it.
  2. Get eclipse and unzip it.
  3. Get the Google App Engine SDK and install it.
  4. Open eclipse and go to Help -> Software Updates -> Find and Install.
    • Choose "Search for new features to install" and click on "Next"
    • Click on "New remote site"
    • Select the PyDev update site you just added
    • Click on "Finish"
    • After the update site has been searched, Choose to install the PyDev plugin (see image below)
    • Click on "Next"
    • accept the agreement
    • Click on "Finish"
    • Click on "Install All"
    • Choose "Yes" to restart eclipse
  5. After eclipse has been started
    • choose Windows -> Preferences to bring up the preferences dialog
    • Change to the "PyDev" -> "Interpreter - Python" section to configure Python
    • Click on "New" right to the "Python interpreters" field to add an interpreter
    • Search for the python.exe executable (normally in C:\Python25)
  • After you selected the executable, PyDev will search for libraries, and the following screen comes up:
    • Normally, the preselection done by PyDev is fine, so click "OK" to accept the system pythonpath entries.
    • In the Preferences Window also click "OK" to confirm your changes.
  1. Now we are ready to create our first python project.
    • Do a right-click in the Package Explorer and choose New -> Other.
    • In the upcoming dialog select "Pydev project" from the Pydev folder.
    • Create a new helloworld project with (!important) Python 2.5 (see image below)
    • After clicking "Finish", eclipse should switch to the Pydev view.
    • Do a right click on your new project and choose "Properties"
    • In the properties dialog choose the "PyDev - PYTHONPATH" section to add the App Engine libraries (we need this for proper code assist)
    • Click on "Add source folder" to add the following folders (see image) from your google appengine folder:

    • Click "OK" to confirm your changes.
  2. For a quick start, you can work on the Getting Started tutorial avalibale.
    Use the "src" Folder as base folder for your project (see image to the right)
  3. The last thing we need to do now is to add a user-defined starter for our Google App Engine development server.
    • Got to "Run" -> "Open Run Dialog"
    • Choose "Python Run" and add a new launch configuration (document icon with the plus sign in the top left of the dialog)

    • Name your run configuration
    • As project choose your python GAE project.
    • As main module, enter the location of the "" script.
    • Change to the "Arguments" tab and enter "${project_loc}/src" as first argument.

      After this argument, you may add all available additional arguments listed on the Dev Webserver documentation page. (here for example we changed the port where GAE is listening to 9999)
    • Click on "Apply" to save your changes
    • Click on "Run" to run your project
  4. From now on you can run your project by selecting your confuguration from the "Run" dropdown and access your app on http://localhost:9999/.
  5. If an error occurs, you can see it in the console view of eclipse and click on it to jump to the error location within your scripts.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License.


  1. Heym great post. Actually you can even debug the application. To do so, go to Run->Open debug dialog ad create new configuration under "Python Run"

    Then, put C:\Program Files\Google\google_appengine\ for the "Main Module" in "Main" tab, and your project name in "Program arguments" in "Arguments" tab.

    That's it - you can debug your web application then :-)

  2. Great! I just started to play with python/appengine, it's beautiful that it's working in eclipse like this. Special thx for code-completion.

  3. Thank you so much for this tutorial.
    You saved me a lot of time.

  4. Nice post.

    I am a little stuck at the part where the google app engine paths need to be added.

  5. Hi Robert,

    for adding the paths, just click on "Add source folder" and browse to the different directories - you can see in this picture, which directories are needed.


  6. Hi Joscha,
    I'm doing the same "Run As" technique to update my application in the real GAE sandbox using the update command, but I'm falling into a very stupid error, when the Eclipse console ask me about my email/password I can't enter them, the editor keeps line breaking. You can maybe help me with that one. Thanks a lot. Great post.

  7. Thank a lot for the nice post!

  8. Thanks for this step-by-step. Saved me a lot of time

  9. @David Cifuentes

    my (ugly) workaround: in ( UserCredentials() ) password input change to "raw_input"

  10. Great article. thanks alot. this really helped me

  11. Great Article it really helped me thanks

  12. Hi,

    the article is really nice. thanks.

    I am trying to configure the step 3.
    but i am getting some error. but if i execute the command src. the server works.

    i am not sure what i am doing wrong.
    i get this error

    File "C:\Python25\lib\", line 37, in
    from calendar import timegm
    ImportError: cannot import name timegm

  13. The YAML Editor ( is another mighty handy plugin given how YAML heavy App Engine is.

  14. Do you have code completion working for the appengine modules?

    For example, how do you get code completion at point x while declaring attributes in a class definition like this:

    class Product(db.Model):
    # Basic info.
    name = db.StringProperty()
    company = db.x

  15. well, to answer my question: make sure you have set up your PYTHONPATH correctly and than, at the beginning of your code file, just don't forget to import the db module from the appenginge extension....

  16. Yes, thank you for this. I'm a Java developer new to Python and was wanting to try out the Google App Engine. I appreciate this writeup very much!

  17. Thank you for this writeup. I'm a Java developer new to Python and was wanting to try out the Google App Engine. This got me going quickly, thanks!

  18. Thanks a lot for your kindness saved me time and patience! Let's see now what is the ptential of this whole Python-Google ecosystem...

  19. Thank you very much for the quick start details.It really works.

  20. Thanks so much for posting this. I'm now happily debugging my GAE app in Eclipse!

    - Tyler

  21. Thanks for great tutorial, it's working well..

    btw i got an error that say the port already in use when trying to re-run the apps.
    it was suggested to use control-C to stop the apps in this docs (
    but it's different when using eclipse. any suggestion to stop last running apps with eclipse?

    he is the error log messege:

    File "/usr/lib/python2.5/", line 341, in server_bind
    File "string", line 1, in bind
    socket.error: (98, 'Address already in use')

  22. Thanks, very good article. This saved me hours.

  23. chandru and anyone else having an error with from calendar import timegm! Same problem here, fixed, it was another calendar module. In this case it was from the gdata-python-client , which does not have the timegm function.

    And i don't know what these post options say, i think I'm posting anonymous.

  24. How do I fix the issue with "from calendar import timegm"?

    Basically getting an error at runtime saying can't find the timegm module.

  25. Congratulations!!! Very nice tutorial!

  26. Thanks for the great article.

    I ported your solution to develop/debug AppEngine applications in Aptana (PyDev):

    Personally I get along with Aptana better ;)

  27. @firdaus :
    one seems to be able to stop the server by using the `terminate`-button as written just above the heading "Uploading to Google App Engine" on

  28. Great post, very helpful. Thank you so much.

  29. Thanks - this has been of great help. Really appreciate it.
    - Ank

  30. Danke für den Artikel. Ich war Austausch-Student @ Uni-Stuttgart.
    Können Sie mir sagen, wie picloud mit GAE zu verbinden. Mail
    besuchen Sie meine Blog
    guten tag.

  31. pyDev url has changed.