0
An Introduction
 to GAEO web
  framework
   ericsk
 OSDC.tw 2009
Agenda

 Google App Engine
 Why GAEO?
 How to use GAEO
 Roadmap
 Live Demo
Google App Engine
         Host your web application and data (w/
         quota limits)
            You don't need to mai...
Google App Engine (cont.)
          Dashboard
Why GAEO?

 I need a web framework.
   webapp is too simple; django is too complicated.
 GAEO: Google App Engine Oil
 Conv...
What is GAEO?

 Model-Template-Controller -based web framework.
   based on webapp
   inspired from Rails/Zend Framework
 ...
GAEO's Architecture

                                                action



                                           ...
Code Layout (GAEO-0.3)
 $APP_BASE/
     application/
         controllers/
         models/
         templates/
     asset...
GAEO URL Routing

Default:
http://example.com/foo/bar/1234

controller: foo (FooController class)action: bar (bar method i...
GAEO Action Controller

  Each request is distributed to an action
  In GAEO, an action is a method of an action controlle...
GAEO Action Controller (cont.)

  Use render method to output different response data. (helps set
  the Content-Type heade...
GAEO Action Controller (cont.)
Sample controller:

from gaeo.controller import BaseController

class FooController(BaseCon...
GAEO Model

  Extends GAE's Model class.
  Add one-to-many and many-to-many helper
  Update properties within single metho...
GAEO Model (cont.)
model sample:

from gaeo.model import BaseModel

class User(BaseModel):
    name = db.StringProperty()
...
How to Use GAEO
Installation

  Download the release archive, and unpack it.
  Install it through easy_install
  Setup the $PATH for using...
GAEO Utilities

 gaeo.py - Create a GAEO project.
 gaeogen.py - Generate a GAEO a controller, model, or
 plugin.
Live Demo
GAEO's Roadmap

 XML-RPC support
 Caching
 i18n support
 RESTful
 Extend the Template engine
 CMS
 ...
GAEO Resources

 Project home:
 http://code.google.com/p/google-app-engine-oil/
 Document site:
 http://doc.gaeo.org/, htt...
Q&A




                     感謝您的收聽
         Thanks for you attendance
      ご清聴とうもありがとうございました
Upcoming SlideShare
Loading in...5
×

An Introduction to GAEO web framework

2,569

Published on

The GAEO talk in OSDC.tw 2009

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,569
On Slideshare
0
From Embeds
0
Number of Embeds
13
Actions
Shares
0
Downloads
45
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "An Introduction to GAEO web framework"

  1. 1. An Introduction to GAEO web framework ericsk OSDC.tw 2009
  2. 2. Agenda Google App Engine Why GAEO? How to use GAEO Roadmap Live Demo
  3. 3. Google App Engine Host your web application and data (w/ quota limits) You don't need to maintain the server, focus on your application Pay for what you use. (no setup fee) Scalable servers and storages Google's infrastructure Cron service (NEW ) Both Python and Java (NEW ) are supported
  4. 4. Google App Engine (cont.) Dashboard
  5. 5. Why GAEO? I need a web framework. webapp is too simple; django is too complicated. GAEO: Google App Engine Oil Convension over configuration. More easily development on GAE to Rails/Zend Framework developers.
  6. 6. What is GAEO? Model-Template-Controller -based web framework. based on webapp inspired from Rails/Zend Framework Implemented in *pure* Python More libraries for request/response processing. easy and powerful URL routing convention session support easy and quick for different output types easy object-relation-model controller and model's hook
  7. 7. GAEO's Architecture action action dispatcher client . request dispatch . . action response
  8. 8. Code Layout (GAEO-0.3) $APP_BASE/ application/ controllers/ models/ templates/ assets/ css/ img/ js/ gaeo/ libs/ plugins/ app.yaml favicon.ico main.py
  9. 9. GAEO URL Routing Default: http://example.com/foo/bar/1234 controller: foo (FooController class)action: bar (bar method in FooController)id: 1234 Configurable & Parameterize: route.connect('/signin', controller='account', action='signin') route.connect('/user/:name', controller='user', action='show') route.connect('/foo/:action/:x/:y/:z', controller='foo')
  10. 10. GAEO Action Controller Each request is distributed to an action In GAEO, an action is a method of an action controller Create a controller class that extends gaeo.controller. BaseController Implement the action class FooController(BaseController): def bar(self): quot;quot;quot; TODO: do things for /foo/bar request quot;quot;quot; pass
  11. 11. GAEO Action Controller (cont.) Use render method to output different response data. (helps set the Content-Type header) Use redirect method to redirect to another action (or URL) Hook action in before_action and after_action function Mobile device detection. (_is_mobile, _is_iphone, _is_android) Session object.
  12. 12. GAEO Action Controller (cont.) Sample controller: from gaeo.controller import BaseController class FooController(BaseController): def bar(self): name = self.params.get('name', 'anonymous') self.render(html='<h1>Hello, %s' % name) def update(self): if self._request_method == 'post': // update some model self.redirect('/foo/edit') else: self.render(text=quot;Invalid Requestquot;)
  13. 13. GAEO Model Extends GAE's Model class. Add one-to-many and many-to-many helper Update properties within single method -- update_attributes Add before_put and after_put hook.
  14. 14. GAEO Model (cont.) model sample: from gaeo.model import BaseModel class User(BaseModel): name = db.StringProperty() email = db.EmailProperty() created = db.DateTimeProperty(auto_now_add=True) def before_put(self): // TODO: check property values if failed: return False
  15. 15. How to Use GAEO
  16. 16. Installation Download the release archive, and unpack it. Install it through easy_install Setup the $PATH for using GAEO's utilities.
  17. 17. GAEO Utilities gaeo.py - Create a GAEO project. gaeogen.py - Generate a GAEO a controller, model, or plugin.
  18. 18. Live Demo
  19. 19. GAEO's Roadmap XML-RPC support Caching i18n support RESTful Extend the Template engine CMS ...
  20. 20. GAEO Resources Project home: http://code.google.com/p/google-app-engine-oil/ Document site: http://doc.gaeo.org/, http://doc-zhtw.gaeo.org/, http://doc-fr. gaeo.org/, http://doc-ja.gaeo.org/ Groups: http://groups.google.com/group/google-app-engine-oil IRC: #gaeo on irc.freenode.net
  21. 21. Q&A 感謝您的收聽 Thanks for you attendance ご清聴とうもありがとうございました
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×