FANDOM


Please see The Unofficial Google Wiki for more.

Google App Engine is a kit for running applications on Google infrastructure.

A sample application Edit

Regular CGI Edit

main.py Edit

see Simple CGI program

app.yaml Edit

application: mysampleapp
version: 1
api_version: 1
runtime: python
 
handlers:
- url: /.*
  script: main.py

webapp Edit

main.py Edit

from google.appengine.ext.webapp import RequestHandler, WSGIApplication
 
HEADER = """
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'
'http://www.w3.org/TR/html4/loose.dtd'>
<html><head><title>comtweet</title>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
</head><body>
<h1>Sample Application</h1>
"""
 
FOOTER = """
</body></html>"""
 
class MainHandler(RequestHandler):
 
    def get(self):
        name = self.request.get('name')
        write = self.response.out.write
        write(HEADER)
        if name:
            write("Hi, " + name + "!")
        else:
            write("Hi, no name!<br />")
            write("<form action=/ method=get>Your name: <input name=name /><input type=submit /></form>")
 
        write(FOOTER)
 
def main():
 
    application = WSGIApplication([
       ('/', MainHandler)
       ], debug=True)
 
    CGIHandler().run(application)
 
if __name__ == '__main__':
    main()

app.yaml Edit

application: mysampleapp
version: 1
api_version: 1
runtime: python
 
handlers:
- url: /.*
  script: main.py

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.