Configuring Eclipse on Windows to Use With Google App Engine

The post “Configuring Eclipse on Windows to Use With Google App Engine” on Google has not been updated since 2008. Here is the updated version for Eclipse 3.7 (Indigo).

Before you start, download and install the following components:

Installing PyDev plugin

  • Start Eclipse
  • Help > Install New Software…
  • Add PyDev update site by clicking Add…
  • Select PyDev in the list.

  • Click Next, Next, Accept the terms, Finish.
  • Confirm that you trust certificate from Aptana Pydev
  • Restart Eclipse

Configuring PyDev

  • Go Window > Preferences
  • Select PyDev > Interpreter – Python
  • Click Auto Config.

  • Click OK

PyDev Perspective

Switch to PyDev perspective:

  • Window > Open Perspective > Other… > PyDev
  • Click OK

Hello World!

Let’s create new project for Hello World application.

  • File > New > Project…
  • PyDev > PyDev Google App Engine Project
  • Next
  • Browse and select path to Google App Engine
  • Click OK

Source Code File

  • Create file: File > New > PyDev Module
  • Specify name – “helloworld”
  • Click Finish
  • Paste the following code into the file:
import webapp2

class MainPage(webapp2.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.out.write('Hello World!')

app = webapp2.WSGIApplication([('/', MainPage)],
                              debug=True)

Configuration file

  • Create file: File > New > File
  • Specify file name – app.yaml
  • Click Finish
  • Paste the following text:
application: helloworld
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /.*
  script: helloworld.app

Run configuration

  • Run > Run configurations…
  • Right click on PyDev Google App Run, select New
  • Specify Project – “helloworld”, and the name of the configuration.
  • Specify full file name dev_appserver.py in the Google App Engine folder:
    e.g. “C:\Program Files (x86)\Google\google_appengine\dev_appserver.py”

  • On the tab “Arguments”, in the text area “Program arguments” specify port and the path to the source files:

  • Click Apply and Close

Run!

  • Now we can start helloworld: Run > Run (or simply Ctrl+F11)

Shortcut to localhost:9999

To make access to your new cool site simpler, you can create an internet shortcut to the URL http://localhost:9999 in the src folder on the disk, and refresh project (by selecting src in the Package Explorer and hitting F5).

Have fun 🙂

5 thoughts on “Configuring Eclipse on Windows to Use With Google App Engine

  1. Dattatreya

    May u please write how to debug an application using pydev, eclipse for appengine and windows.

    Thanks in advance

    Like

    Reply
    1. dmytro Post author

      I am not that strong in development of web applications using app engine. I think googling “Debugging Google App Engine” will give you some ideas…

      Like

      Reply
  2. Lawrence

    This step have problem:
    On the tab “Arguments”, in the text area “Program arguments” specify port and the path to the source files:

    The path in the screenshot should be double quoted or it won’t work for at least Python2.7

    Like

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s