Wednesday 9 January 2013

Beginning Guide to Google App Engine

To start with i would like to say that Goggle App Engine is cool. You can build your own app's and post it online ( Free up-to 10) and use it personally or publicly.

Now lets get started with it.-

Download Google App Engine : download here
Chose your language of preference.

Install the application on your system.
I am using Ubuntu so i downloaded the zip file and extracted it into a folder. ( and installation complete)

I downloaded Python version of the app.

Next create a folder named 'helloworld'.

Create 2 files in it.

First file 'app.yaml'
                   
application: helloworld
version: 1runtime: python27api_version: 1threadsafe: true
handlers:- url: /.*
script: helloworld.app
         

Second file 'helloworld.py'
use the java code or Go code which you prefer and get them here Java project link

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)
Next open terminal and go to the extracted or Installed directory and type :
./dev_appserver.py <directory of project>

Once this runs ok, go to :
http://localhost:8080/

You should be able to see the Project up and running locally.

Next what you need to do is get it online.

Since its a web-app it goes online a little different from a web-site:
go to https://appengine.google.com/ and sign Up first.

Next create 1 application 

Give it some lowercase alphanumeric name and you will get a link somewhat like this <name>.appspot.com

Next Big task is to upload you application online:
Go to your Installation directory again and run the app-uploader application
./appcfg.py --oauth2 update <application directory> --application=<application id>

a webpage will open . Login with your Google acc credentials.

One important thing : if your upload ./appcfg.py --oauth2 update is failing with Error 403 : You do not have permission to modify this app (app_id=u'helloworld').

Then you are making a mistake with the AppID.. change it to the appId that you have created.

Next go back to your App online :

https://appengine.google.com/

Open the application link on a new page and your application is Up and running



Happy Programming :)

PS: Feel free to leave a comment below in case of any issue.

1 comment: