Sunday, March 3, 2013

Lets build v1

Hope you all had a fun time building your first web application hosted on Google's cloud platform aka Google App Engine [GAE].

Here's a summary of what we did today. The cloud computing slides which I showed you all can viewed on this link:
http://home.iitj.ac.in/~shashank/ppt/SEngg/#/step-1

Step 1:
Install Python version 2.7.

Step 2:
Install GAE SDK for python.

Step 3:
Go to GAE site. Login with your google credentials and go to Admin Console on the left hand side.
Next, create new application by choosing an available Application Identifier.

Step 4:
Run GAE launcher and do the following configurations.
Edit > Preferences > Python Path

You may optionally set the path of the editor as well.

Step 4:
Once everything is configured you can create a new application by going  to
File > Create New Application

Make sure you put the "Application Identifier" you gave to your web app earlier in the "Application Name" field over here.

Now run your application and see it running on localhost:8080 or locolhost: in any browser.
Voila!! and you have your first web app running.

Now the next phase was to understand and modify the web app.

There are basically three parts to your app and all of them reside in the parent directory which you had selected earlier while creating your app in the launcher.
1: Main.py [Logic Part]
2: Templates Directory [All your .html files go here]
3: app.yaml [the configuration file which we will rarely touch]

The main.py files had few lines already written in in. We discussed what they mean. Basically the last line:
app = webapp2.WSGIApplication([('/', MainHandler),('/aboutme', AboutMe)], debug=True)
meant : We paired the "Path" and the corresponding "Class" in round brackets aka Tuples eg. ('/', MainHandler), so whenever one try to access those links the corresponding class handles the stuff for you.

We discussed the common HTTP headers "GET" and "POST" etc. and how the code handled them.

This was basically all that was done. You can find almost all the material we discussed on https://www.udacity.com/course/cs253

Have a look at it. Also try learning python. You can visit http://www.codecademy.com/ to learn python and brush up your "HTML" & "CSS" knowledge.

Note: You can download my final code from my skydrive: http://sdrv.ms/YHC7sx

Comment if you have any doubts or queries.

Happy Coding.