• http://www.techneurons.com/career/
  • experienced programming consultants for hire !!!

    Contact Now

    Google AppEngine Articles

    KB: Google App Engine - Getting started

    THURSDAY, JUNE 9, 2011
    With App Engine, we can build web applications using the Python/Java programming language, and  our application runs on Google's scalable infrastructure, and uses large-scale persistent storage and services.

    The Python Runtime Environment

    App Engine includes a simple web application framework, called webapp, to make it easy to get started.App Engine supports Python 2.5. Our app take advantage of the many libraries, tools and frameworks for Python.

    The Development Environment

    We can develop and upload Python applications for Google App Engine using the App Engine Python software development kit (SDK).

    The Python SDK includes a web server application that simulates the App Engine environment, including a local version of the datastore, Google Accounts, and the ability to fetch URLs and send email directly from your computer using the App Engine APIs. The Python SDK runs on any computer with Python 2.5

    Creating the first application

    Create a directory named helloworld. All files for the sample application reside in this directory.

    Creating the Configuration File

    An App Engine application has a configuration file called app.yaml. Among other things, this file describes which handler scripts should be used for which URLs.

    The contents of app.yaml file are as below 

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

    From top to bottom, this configuration file says the following about this application:

    *The application identifier is helloworld. When we register our application with App Engine ,we will select a unique identifier, and update this value. This value can be anything during development. For now, leave it set to helloworld.

    *This is version number 1 of this application's code. If we adjust this before uploading new versions of our application software, App Engine will retain previous versions, and let us roll back to a previous version using the administrative console.

    *This code runs in the python runtime environment, version "1". Additional runtime environments and languages may be supported in the future.

    *Every request to a URL whose path matches the regular expression /.* (all URLs) should be handled by the main.py script.

    Working with webapp Framework

    App Engine includes a simple web application framework of its own, called webapp. The webapp framework is already installed in the App Engine environment and in the SDK, so do not need to bundle it with our application code to use it.

    A webapp application has three parts:

    one or more RequestHandler classes that process requests and build responses

    a WSGIApplication instance that routes incoming requests to handlers based on the URL

    a main routine that runs the WSGIApplication using a CGI adaptor

    Let's write our friendly greeting as a webapp application. Create helloworld/main.py with the following contents :

    class MainPage(webapp.RequestHandler):
        def get(self):
            self.response.headers['Content-Type'] = 'text/plain'
            self.response.out.write('Hello, webapp World!')
    application = webapp.WSGIApplication(
                                         [('/', MainPage)],
                                         debug=True)
    def main():
        run_wsgi_app(application)
    if __name__ == "__main__":
        main()

    Testing the Application

    With a handler script and configuration file mapping every URL to the handler, the application is complete. We can now test it with the web server included with the App Engine SDK.

    If we're using the Google App Engine Launcher, we can set up the application by selecting the File menu, Add Existing Application..., then selecting the helloworld directory. Select the application in the app list, click the Run button to start the application, then click the Browse button to view it. Clicking Browse simply loads (or reloads) http://localhost:8080/ in our default web browser.

    If we're not using Google App Engine Launcher, start the web server with the following command, giving it the path to the helloworld directory:

    google_appengine/dev_appserver.py helloworld/

    The web server is now running, listening for requests on port 8080. We can test the application by visiting the following URL in our web browser:http://localhost:8080/

     

    ConsultSarath - We provide end to end outsourcing solutions for .net programming requirements- you can hire programmer for hourly rates, for monthly commitments, for short term projects, for long term projects, Contact to know our hourly rates for programmer in India. ConsultSarath - We provide end to end outsourcing solutions for php programming requirements- you can hire programmer for hourly rates, for monthly commitments, for short term projects, for long term projects, Contact to know our hourly rates for programmer in India. ConsultSarath - We provide end to end outsourcing solutions for python programming requirements- you can hire programmer for hourly rates, for monthly commitments, for short term projects, for long term projects, Contact to know our hourly rates for programmer in India.

    Other Popular Articles
    We are experts in Cloud Computing Technologies. We can assist you to build high scalable business applications using Amazon Web Services (Amazon EC2, Amazon S3, Amazon SES, SNS, CloudFront), Windows Azure Platforms - Windows Azure and SQL Server Azure, Google App Engine using Python and Django Framework. We are Expert Programming Consultants available at affordable rates per hour. We work on several technologies - .NET, Python, Google App Engine, PHP, Windows Azure, Amazon Web Services ...