boodebr sandbox App Engine samples and tutorials from boodebr.org


Recently Edited
HelloWorld edit
frank, 17 July 2008 (created 06 July 2008)
Now its time to try our first bit of dynamic content. Here is the simplest possible "hello world" application. Note that this is a plain WSGI application - it neither knows no cares that it is running under AppEngine!

Create hello/hello.py:
# straight out of PEP 333 (http://www.python.org/dev/peps/pep-0333/)
def simple_app(environ, start_response):
    "Simplest possible application object"
    status = '200 OK'
    response_headers = [('Content-type','text/plain')]
    start_response(status, response_headers)
    return ['Hello from CGI Handler!\n']

# does not know nor care that it is running under AppEngine!
from wsgiref.handlers import CGIHandler
CGIHandler().run(simple_app)


Update app.yaml and add:
- url: /hello.*
  script: hello/hello.py


Now try it out: http://boodebr.appspot.com/hello

Notice our simple application does not care what URL you pass to it, it always gives the sample result. For example: http://boodebr.appspot.com/hello/a/b/c?q=123&z=789



blog comments powered by Disqus