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:
- Python – e.g. Python 2.7.2 Windows Installer for Windows
- Eclipse – e.g. Eclipse Classic 3.7
- Google App Engine SDK – e.g. GoogleAppEngine-1.6.0.msi
Installing PyDev plugin
- Start Eclipse
- Help > Install New Software…
- Add PyDev update site by clicking Add…
- Choose a name (e.g. “pydev”).
- Enter “http://pydev.org/updates/” in the URL field.
- Click OK.
- 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)
- Go to http://localhost:9999 in a browser and see the results of your efforts:)
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 🙂
May u please write how to debug an application using pydev, eclipse for appengine and windows.
Thanks in advance
LikeLike
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…
LikeLike
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
LikeLike
Well, I assume if there is no spaces in the path, it is not required.
LikeLike
Very Very Good Tutorial. Thanks alot!
LikeLike