Tuesday 27 November 2012

Google app engine 1st Application

Hello Everyone,

Now we are going to run our first application in google app engine.

1. Select new project from File Menu , new project as PyDev Google App Engine Project.

2. Specify the name of project "Helloworld"

3. Select google app engine ' s home directory usually /home/user/google_appengine

4. Create a new file named helloworld.py and add the following contents to it.



import webapp2
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.write('Hello, webapp2 World!')
app = webapp2.WSGIApplication([('/', MainPage)],
debug=True)


5. Now crate configuration file named app.yaml , add following contents to it.

application: helloworld
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /.*
  script: helloworld.app


6. Now right click on project , and click on run. You can see output at http://localhost:8080




No comments:

Post a Comment