Google App Engine lets you to run web applications on google's infrastructure without any cost. We dont need to maintain any server for our application here. App engine supports application written in several languages. The three important environments for app engine are Java runtime environment, Python runtime environment, Go runtime environment.
The main features of Google App Engine are
- Dynamic web serving, with full support for common web technologies
- Persistent storage with queries, sorting and transaction
- Automatic scaling and load balancing
- APIs for authenticating users and sending email using Google Accounts
- A fully featured local development environment that simulates Google App Engine on your compute
- Task queues for performing work outside of the scope of a web request
- Scheduled tasks for triggering events at specified times and regular intervals
The Python Runtime Environment
Here we are going to discuss how to develop and upload applications with Google App Engine using the python environment. The python software development kit (SDK) has to be downloaded which includes a web server application that simulates the App Engine environment. Download the App Engine SDK and follow the instructions on the download page to install the SDK on your computer.
Creating a Google App Engine project
Let us discuss the procedure to create a web application using App Engine step by step.
Testing and uploading the application
You can start the web server with the following commant
You can test the application by visiting the following URL in your web browser:
Here we are going to discuss how to develop and upload applications with Google App Engine using the python environment. The python software development kit (SDK) has to be downloaded which includes a web server application that simulates the App Engine environment. Download the App Engine SDK and follow the instructions on the download page to install the SDK on your computer.
Creating a Google App Engine project
Let us discuss the procedure to create a web application using App Engine step by step.
- Sign into the Gooogle App Engine using your google account and create an application. A unique application id is to be selected for a new application.
- Create a directory named after the application id in your home directory.
- Add the files app.yaml, main.py and the application file
- Edit the app.yaml file as given below:
application: sampleprogram
version: 1
api_version: 1
runtime: python
handlers:
- url: /.*
script: main.py
Where sampleprogram is the application id.
- Edit the main.py file as follows:
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("exampleprogram.html",{}))
def main():
app = webapp.WSGIApplication([
(r'.*',main1)], debug=True)
wsgiref.handlers.CGIHandler().run(app)
if __name__ == "__main__":
main()
Where exampleprogram.html is the actual application program.Testing and uploading the application
You can start the web server with the following commant
google_appengine/dev_appserver.py "path to applicationid folder"the path is given to the sampleprogram directory
You can test the application by visiting the following URL in your web browser:
http://localhost:8080/
To upload your finished application to Google App Engine, run the following command:appcfg.py update "path to applicationid folder
Now the application is set with the App Engine and can be accessed using the url http://your_app_id.appspot.com.
Comments
Post a Comment