say Hello, World! in Google Appengine.

Leave a Comment


Lets start.
# Creating a Simple Request Handler :-
Python App Engine applications communicate with the web server using the CGI standard. When the server receives a request for your application, it runs the application with the request data in environment variables and on the standard input stream (for POST data).

* create an application directory.
if you are using Linux,create the application in the Google Appengine directory.
eg. google-appengine/

* Create a directory named "helloworld". All files for this application reside in this directory.

e.g-
google-appengine/helloworld

* Inside the helloworld directory, create a file named "helloworld.py", and give it the following contents:

----------------------------------------------
print 'Content-Type: text/plain'
print ''
print 'Hello, world!'
----------------------------------------------

This Python script responds to a request with an HTTP header that describes the content, a blank line, and the message Hello, world!.

# 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.

* Inside the directory, create a file named "app.yaml" with the following contents:

------------------------------------------------
application: helloworld
version: 1
runtime: python
api_version: 1

handlers:
- url: /.*
  script: helloworld.py

-------------------------------------------------

* The application identifier is "helloworld". When you register your application with App Engine in the final step, you 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 you adjust this before uploading new versions of your application software, App Engine will retain previous versions, and let you 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 "helloworld.py" script.

For a complete list of configuration options, see the app.yaml reference.

# Testing the Application

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

--------------------------------------------------
google_appengine/dev_appserver.py helloworld/
--------------------------------------------------
if you are a Linux User use the command after change the google_appengine dir.
e.g :-

$cd google_appengine/
$python dev_appserver.py helloworld/


* The web server is now running, listening for requests on port 8080. You can test the application by visiting the following URL in your web browser:

* http://localhost:8080/

* To shut down the web server, make sure the terminal window is active, then press Control-C (or the appropriate "break" key for your console), or click Stop in Google App Engine Launcher.


Position of Application dir :-

google_appengine /
- [many files & folder]

- dev_appserver.py
- appcfg.py

- helloworld/
- helloworld.py
- app.yaml



Here is the codes and command for run the appication on LinuxOS






Running application on port http://localhost:8080/