Wednesday, December 17, 2008

learning google appengine in 5 minutes

Creating an App Engine application is easy, and only takes a few minutes.

First you need to download the following packages

  1. Python www.python.org/download/releases/2.5.2/
  2. SDK www.code.google.com/appengine/downloads.html

Creating a Simple Request Handler

Create a directory named helloworld. All files for this application reside in this directory.Inside the helloworld directory, create a file named helloworld.py, and give it the following contents:

print 'Content-Type: text/plain'  
print '' print 'Hello, world!'


This Python script responds to a request with an HTTP header that describes the
content, a blank line, and the message Hello, world!.

Creating the Configuration File

An App Engine application has a configuration file called app.yaml. Among other things, this file describes which handler scripts should be used for which URLs.

Inside the helloworld directory, create a file named app.yaml with the following contents:

application: helloworld
version: 1
runtime: python
api_version: 1

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

Testing the Application

google_appengine/dev_appserver.py helloworld

Type the following URL and enjoy!

http://localhost:8080/










Reference
http://code.google.com/appengine/docs/gettingstarted/

No comments: