Configuring Eclipse on Windows to Use With Google App Engine
This article was written and submitted by an external developer. The Google App Engine team thanks Joscha Feth for his time and expertise.
Joscha Feth
June 2008
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 several minutes to find out how to get code completion working with Google App Engine.
So here is a small how-to for getting App Engine with Eclipse and PyDev up and running.
Downloading the componentsBefore you get started, you will need to set up your environment properly. To do this, you will need to download and configure the following components on your machine:
- Get Python and install it.
- Get Eclipse and unzip it.
- Get the Google App Engine SDK and install it.
Once you have the above components, you can set up the PyDev Eclipse extension, which is customized for Python developers.
- Open Eclipse and go to Help -> Software Updates -> Find and Install.
- Locate and Install PyDev:
- Choose Search for new features to install and click on Next.
- Click on New remote site:
- Choose a name.
- Enter "http://pydev.sourceforge.net/updates/" in the URL field.
- Click OK.
- Select the PyDev update site you just added:
- Click on Finish
- After the update site has been searched, choose to install the PyDev for Eclipse:
- Click on Next.
- Accept the agreement.
- Click on Finish.
- Click on Install All.
- Choose Yes to restart Eclipse.
- After Eclipse restarts:
- Choose Windows -> Preferences to bring up the preferences dialog.
- Change to the PyDev -> Interpreter - Python section to configure Python.
- Click on New which is located just right of the "Python interpreters" field to add an interpreter:
- Search for the "python.exe" executable (normally in C:\Python25).
- After you select the executable, PyDev will search for libraries, and the following screen appears:
- Normally, the pre-selection done by PyDev is fine, so click OK to accept the system pythonpath entries.
- In the Preferences window, click OK to confirm your changes.
After you have PyDev installed on Eclipse, you are ready to start developing your application!
- Let’s create our first Python project:
- Right-click on the Package Explorer and choose New -> Other.
- In the upcoming dialog, select Pydev project from the Pydev folder.
- Create a new helloworld project with Python 2.5 (important!):
- After clicking Finish, Eclipse should switch to the Pydev view.
- 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 from your "google appengine" folder:
- Click OK to confirm your changes.
- For a quick start, you can work on the Getting Started tutorial available. Use the "src" Folder as base folder for your project:
- The last thing we need to do now is to add a user-defined starter for our Google App Engine development server:
- Go 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.
- Under "Project", add your Google App Engine Python project.
- Under "Main Module", enter the location of the "dev_appserver.py" 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.
From now on, you can run your project by selecting your confuguration from the "Run" dropdown and access your app on http://localhost:9999/. 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:
When you are ready to upload your app, simply upload the application’s ‘src’ folder using appcfg.py.
本文转载自:http://code.google.com/appengine/articles/eclipse.html
...