The Google App Engine Oil Framework
Upcoming SlideShare
Loading in...5
×
 

The Google App Engine Oil Framework

on

  • 4,632 views

Intro to GAEO framework

Intro to GAEO framework

Statistics

Views

Total Views
4,632
Views on SlideShare
4,606
Embed Views
26

Actions

Likes
1
Downloads
30
Comments
0

2 Embeds 26

http://www.slideshare.net 23
http://www.linkedin.com 3

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

The Google App Engine Oil Framework The Google App Engine Oil Framework Presentation Transcript

  • The Google App Engine Oil (GAEO) Framework Lin-Chieh Shangkuan (ericsk)
  • Outline Google App Engine overview Why we develop the GAEO framework What's done in GAEO 0.1 GAEO's current & future features How to start using GAEO (DEMO) GAEO links Q&A
  • Current Google App Engine An application server with pure Python runtime language also a web server for you (HTTP) Request-based environment Uses BigTable as database Application version control and seamless upgrades/degrades. HTTPS support (*.appspot.com only) View slide
  • Developing Applications on AppEngine View slide
  • Request-based Configuration ctrl_list = ['Tag', 'User', 'Ziza'] app = webapp.WSGIApplication([ ('/', IndexView), ('/home', HomeView), ('/explore', ExploreView), ('/replies', RepliesView), ('/signup', SignupView), ('/settings', SettingsView), ('/tags', TagsView), ('/m/([^/s]*)', MsgView), ('/f/([^/s]*)', FeedsView), ('/r/([^/s]*)', FeedsWithFriendsView), ('/u/([^/s]*)', UserView), ('/t/([^/s]*)', TagView), ] + [(r'/%s/(.*)' % s.lower(), eval(s + 'Controller')) for s in ctrl_list], debug=True)
  • Handle HTTP Request class IndexView(webapp.RequestHandler): def get(self): # get the user object user = users.get_current_user() if user: # the user has logined self.redirect('/home') template_values = { 'signin_url': users.create_login_url('/home'), }
  • Deployment
  • Why do we develop a framework on AppEngine?
  • Goal To be familiar with AppEngine Convention over configuration Structured, meaningful, parameterized URL More helper methods Quickly migrate from ZF or Rails For team works
  • Software Architecture action action client dispatcher request . dispatch . . action response
  • Code Layout (0.2) $APP_BASE/ application/ controllers/ models/ templates/ assets/ css/ img/ js/ gaeo/ plugins/ app.yaml favicon.ico main.py
  • GAEO 0.1 released at Sep. 19, 2008
  • 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')
  • 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
  • Response Helper Use to_json method (uses simplejson) to convert a dict instance to a JSON string Use render method to output different response data. (helps set the Content-Type header) Use redirect method to redirect to another action (or URL) Do something in before_action and after_action filters
  • Session support Store data at server (mapping clients via Session-IDs that stores in cookies) GAEO has designed a session interface and a memcache- session implementation. Use self.session in the actions.
  • Model enhancement Add some helper methods update_attributes save, update Naming query A beginning of ORM belongs_to method
  • Other helpers Object shortcuts: request response cookies Mobile device detection _is_iphone _is_mobile
  • GAEO 0.2 beta released at Oct. 31, 2008
  • Setuptools support Now you can use easy_install gaeo to install the GAEO package. Also available on pypi http://pypi.python.org/pypi/gaeo Provided by gasolin
  • Scaffold Quickly generates some common pages new list show edit create update destroy Provided by xeonchen
  • Plugins Provides plugins system in GAEO Install features on demand 3rd party development :-p
  • Other Enhancements Global initialization application_init method (in ApplicationController) AJAX/Form helpers generates some useful AJAX/form strings The respond_to method respond content according to :format parameter zip core import You can zip the GAEO core to eliminate disk space cost methods enhancements
  • GAEO's Future future
  • Roadmap RESTful mobile device support i18n new template rendering engine ...
  • GAEO Links Document: http://doc.gaeo.org/ Project: http://code.google.com/p/google-app-engine-oil Blog: http://blog.gaeo.org/ Groups: http://groups.google.com/group/google-app-engine-oil
  • Q&A 感謝您的收聽 Thanks for you attendance ご清聴とうもありがとうございました