Introduction
Lately I have been reading quite a lot of articles about Google App Engine, and I just couldn’t resist trying it out myself.
Google App Engine enables you to build web applications on the same scalable systems that power Google applications.
If this is the first time you are hearing about the Google App Engine, it would be a good idea to read this introductory document.
The following post is based on the official “Getting Started” guide.
Setup
Setup is quite easy, all you need is the Google App Engine SDK, and the Python Runtime software.
I am using Windows XP, so I have downloaded the “GoogleAppEngine_1.0.1.msi” and “python-2.5.2.msi” installers from the above links.
Both of them are available for Windows/Mac/Linux, so you can download the required files according to your Operating System.
Installation is also straight-forward, I have installed both of them with the default options. There was no need to edit config files or do something else.
Google App Engine even sets a “Path” Environment Variable in Windows to make the development web server more accessible.
Coding – Part 1
Here comes the fun part, let’s find out how to build the “Hello World” application.
Create a new folder on your hard disk called “helloworld”.
Fire up your favorite text editor, mine is Notepad++, and paste the following code:
print 'Content-Type: text/plain' print '' print 'Hello World!'
Save the file as “helloworld.py” inside the folder “helloworld”.
Create a new text file called “app.yaml” in the same folder with the following contents:
application: helloworld version: 1 runtime: python api_version: 1 handlers: - url: /.* script: helloworld.py
The “app.yaml” is the configuration file, you can find more information about it here.
Now let’s start the development web server by typing in the command prompt:
“dev_appserver.py D:\GoogleAppEngine\helloworld”
Please replace the “D:\GoogleAppEngine\helloworld” with the path of your “helloworld” folder.
Point your web browser to http://localhost:8080/ , and you should see something like the following output:

Now change the “helloworld.py” a bit:
print 'Content-Type: text/plain' print '' print 'Hello World! - Google App Engine rocks!'
Save it, refresh your browser, and you should see:

The development web server is monitoring the project files, thus you can automatically view the changes!
Coding – Part 2
On this second part we are going to use the included, with the SDK, “webapp” framework.
Let’s create a new Python script file called “helloworld2.py” with the following contents:
import wsgiref.handlers
from google.appengine.ext import webapp
class MainPage(webapp.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Hello World from the webapp framework!' )
def main():
application = webapp.WSGIApplication(
[('/helloworld2', MainPage)],
debug=True)
wsgiref.handlers.CGIHandler().run(application)
if __name__ == "__main__":
main()
We also need to modify the configuration file (app.yaml), in order to specify the url that is going to handle the second script:
application: helloworld version: 1 runtime: python api_version: 1 handlers: - url: / script: helloworld.py - url: /helloworld2 script: helloworld2.py
As you can see, we changed the first handler (/.* -> /) to respond only to the root directory.
Also we added a second handler to respond on the /helloworld2 path.
Navigate your browser to http://localhost:8080/helloworld2 and you should see:

You can find here more information about the “webapp” framework and how to use it.
Conclusion
Well that was just the beginning to an exciting new way of developing web applications.
The API is under heavy development, and definitely you have to spend some time in order to get familiar with it, and build a real-world application.

[...] 11, 2008 by decoding This is my second article about the Google App Engine. On the previous article, I have gone through the installation/setup process, and a “Hello World” [...]
I have gone through the install exactly as you have stated, but keep getting errors. I have let the install program install in the default directory:
>>> os.getcwd()
‘C:\\Program Files\\Google\\google_appengine’
When I try to run the program I get the following error:
>>> dev_appserver.py helloworld
SyntaxError: invalid syntax
>>> dev_appserver.py
Traceback (most recent call last):
File “”, line 1, in
dev_appserver.py
NameError: name ‘dev_appserver’ is not defined
>>>
I have been banging my head against the wall trying to figure out how to fix this obviously easy problem but I can’t find the problem, anyone know what’s going on?
@Scott: Let’s suppose that you create your folder in “C:\helloworld” .
All you have to do is start the Windows command prompt, not the Python command line.
And type: “dev_appserver.py C:\helloworld”
I think that problem arises because of the space in “Program Files”. I finally got it working by installing it in a similar directory as above. This is the line that got it going:
dev_appserver.py C:\google_appengine\helloworld
@Ander: At least for me, on Windows XP, it is working fine on default “Program Files” installation.
Problem with http://localhost:8080/helloworld2
On my Windows Vista System (i tried 2 different PC) /helloworld2 dont work.
if Uploaded un myapp.appspot.com it work.
You rock dude. I tried different methods to get App engine working but your’s so simple yet powerful method. Thanks.
@Sambi: Thanks for the feedback, I am glad you found it helpful.
Is really helpful before i saw this blog i was trying out the steps provided by google but it didn’t work. Thank you=)
@yuki: Glad it worked for you
Appriciate this blog…helped my past a dumb spot getting the app engine thing running on my PC. Together with the Google Youtube intro on the app enginge this is starting to make a little more sense…