Wednesday, July 16, 2008

Working with Google App Engine Framework

Every language or platform should have frameworks, those are library that just accelerate development speed and better your work.
For example, the Dot Net Framework, try just to compare it with the dot net assembly language. So here's a simple and easy to use example!

While typing huge lines of code to shut down a computer...
'calling windows api
'if..then..end if
and some lines of code
You replace the work with
Windows.shutdown

Framework are huge libraries that replace ALL the code, so you don't have to work with the simple python now. This is an important step if you are going to work with Google App Engine and build secure application and long lines of code.

Google App Engine accept FrameWorks, (it's better to say Python!).
I was in this page and noticed that Google SDK have already a framework included; however if you want to include another framework, you simply have to include its' code in a folder on your project. Like Pear with PHP.

Google App Engine include a simple Framework of its' own, called Webapp

The test application will become then...


import wsgiref.handlers

from google.appengine.ext import webapp

class MainPage(webapp.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Test')

def main():
application = webapp.WSGIApplication(
[('/', MainPage)],
debug=True)
wsgiref.handlers.CGIHandler().run(application)

if __name__ == "__main__":
main()


A first look on the code.. that's too long! Yes but easy to understand, if you can't learn it, then you should find a code editor like the Visual Studio editor for .net

No comments:

Interested on Microsoft Technologies? Read Visual Studio Dot Net