Friday 7 December 2012

Google App Engine





Google App Engine lets us to run web applications on Google's infrastructure.
We can serve our app from our own domain name using Google Apps. Or, we can serve our app using a free name on the appspot.com domain. Through this Google Apps, we can share our application with our friends, organizations and with the whole world.

App Engine Features:

1. Dynamic web serving, with full support for web technologies
2. Persistent storage with queries, sorting and transactions
3. Automatic scaling and load balancing.
4. APIs for authenticating users and sending email using Google Accounts.
5. A fully featured local development environment that simulates Google App 
    Engine on your computer.
6. Task queues for performing work outside of the scope of a web request.
7. Scheduled tasks for triggering events at specified times and regular intervals.

Google Apps can run in one of three runtime environments: the Go environment, the Java environment, and the Python environment.

Python Runtime Environment

With Google App Engine's Python runtime environment, we can implement our app using the Python programming language. App Engine includes rich APIs and tools for Python web application development. We can also take advantage of a wide variety of mature libraries and frameworks for Python web application development.

Create your first Google App engine project

Before we do anything else, you’ll need to install the Google App Engine SDK. You’ll need Python 2.5 too. You won’t be writing any Python code but the App Engine SDK will need it to run on your computer.

You’ll need to choose a unique ‘application id’ nothing more than a name for your project. Make sure it consists only of lowercase letters and numbers. 

On your computer, create a folder named after your application id.

Create a file app.yaml in that folder. It tells App Engine what to do with your files.And we need to add these lines.

application: hunterstimer
version: 1
api_version: 1
runtime: python
handlers:

- url: /.*
  script: main.py 
Here main.py is the python file where we access our web application file, for example "hunter.html".

For this, we need to add these lines to main.py file.
import wsgiref.handlers
from google.appengine.ext import webapp
from google.appengine.ext.webapp import Request
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext.webapp import template

class main1(webapp.RequestHandler):
 def get(self):
           self.response.out.write(template.render("hunter.html",{})) 
  
def main():
    app = webapp.WSGIApplication([
        (r'.*',main1)], debug=True)
    wsgiref.handlers.CGIHandler().run(app)

if __name__ == "__main__":
    main()
Where the hunter.html file can be replaced with your application file and place that file in the application id folder.

Registering the Application

Sign in to App Engine using your Google account here.

To create a new application, click the "Create an Application" button. Follow the instructions to register an application ID, a name unique to this application. If you elect to use the free appspot.com domain name, the full URL for the application will be http://your_app_id.appspot.com/. Edit the app.yaml file, then change the value of the application: setting to your registered application ID.

Testing the added appllication

Start the web server with the following command:
google_appengine/dev_appserver.py "path to applicationid folder"
 Now you can test the application by visiting the following URL :
http://localhost:8080/
Uploading the Application
appcfg.py update "path to applicationid folder"
Enter your Google username and password at the prompts.
You can now see your application running on App Engine with the url http://your_app_id.appspot.com.

Click here to see an example:


[Expecting Your Valuable Comments]
Thank You

No comments:

Post a Comment