using google appengine

24
使用GoogleAppEngine做个人信 息中心 weibo.com/sagasw twitter.com/sagasw

Upload: wei-sun

Post on 21-Jan-2015

1.277 views

Category:

Technology


3 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Using google appengine

使用GoogleAppEngine做个人信息中心

weibo.com/sagaswtwitter.com/sagasw

Page 2: Using google appengine

个人信息服务聚合

● Twitter 客户端

● RSS 聚合

● 获取网页 (urlfetch)

● Cron Jobs● 个人笔记

● 好玩的玩具

● 了解云计算 (自己订制用的越多,花钱越多)

Page 3: Using google appengine
Page 4: Using google appengine
Page 5: Using google appengine
Page 6: Using google appengine
Page 7: Using google appengine

Google AppEngine编程语言 Go language, Python, Java (JRuby, Lua, Rails etc.)免费限额对于个人日常使用,已经足够常用及有用的特点

○   UrlFetch, Memcache, XMPP, Mail, TaskSchedule, Cron○   OAuth, Google 账号绑定  

○   Image 处理

○   MapReduce, Channel, High Replication Datastore○   Custom domain○   容易使用,容易管理,数据 统计信息强大

○   容易扩展,可以抵抗

缺点: 没有全文搜索, 新的价格调整, 需要熟悉新的SQL方式, Python2.5, 不能使用C扩展

Page 8: Using google appengine

使用Django

The App Engine Python environment includes these versions of Django: 1.2, 1.1, 1.0, and 0.96

Tornadohttps://github.com/facebook/tornado/tree/master/demos/appenginehttp://www.tornadoweb.org/documentation/wsgi.html?highlight=appengine

Page 9: Using google appengine

用于AppEngine的Python库

BeautifulSoupPython-TwitterPython-Readability... ...

什么样的Python扩展可以用于AppEngine?

● 没有用到 C-Extensions的, 

● 没有用到关系型数据库, 

● 不需要访问本地资源的,

Search http://pypi.python.org/pypi

Page 10: Using google appengine

Lua in Appengine

With Java's helphttp://code.google.com/p/aelua/

http://code.google.com/p/jillcode/http://code.google.com/p/kahlua/https://github.com/krka/kahlua2http://sourceforge.net/projects/luaj/

Page 11: Using google appengine

from google.appengine.ext import webappfrom google.appengine.ext.webapp.util import run_wsgi_app

application = webapp.WSGIApplication([('/', MainPage),                                      ('/newentry', NewEntry),                                      ('/editentry', EditEntry),                                      ('/deleteentry', DeleteEntry),                                     ],                                     debug=True)

def main():    run_wsgi_app(application)

if __name__ == '__main__':    main()

Page 12: Using google appengine

import reimport tornado.webimport tornado.wsgiimport wsgiref.handlersfrom google.appengine.api import usersfrom google.appengine.ext import db

class Entry(db.Model):    author = db.UserProperty()    title = db.StringProperty(required=True)    html = db.TextProperty(required=True)    published = db.DateTimeProperty(auto_now_add=True)    updated = db.DateTimeProperty(auto_now=True)

def administrator(method):class HomeHandler(BaseHandler):    def get(self):        entries = db.Query(Entry).order('-published').fetch(limit=5)        if not entries:            if not self.current_user:                self.redirect("/compose")                return        self.render("home.html", entries=entries)... ... ... ... application = tornado.wsgi.WSGIApplication([    (r"/", HomeHandler),    (r"/archive", ArchiveHandler),    (r"/feed", FeedHandler),], **settings)

def main():    wsgiref.handlers.CGIHandler().run(application)

if __name__ == "__main__":    main()

https://raw.github.com/facebook/tornado/master/demos/appengine/blog.py

Page 13: Using google appengine

Using AppEngine in Enterprise Dev?● 现在还不合适,推荐Amazon EC2

● 作为前端,可以很容易扩展

● 作为练习平台

● 使用于特定的部分的任务

http://code.google.com/appengine/business/

App Engine for Business is no more, but don't worry. Almost all the features you wanted in App Engine for Business will now be available to all App Engine developers in an upcoming release. This includes:

● SSL for custom domains● Support● Hosted SQL● Service-level Agreement

Page 14: Using google appengine

http://www.google.com/events/io/2011/sandbox.html

    Wiki, CMS, MicroBlogging, GameServer, AppServer, Wedding, Ask-Answer, EBook, SNS Server, Online Shop, Workflow

can NOT    Video, Audio, big files hosting, High computing, High CPU usage, image hosting

Page 15: Using google appengine
Page 16: Using google appengine

Google AppEngine 价格和用量继续微调

http://www.guao.hk/posts/google-app-engine-price-changes.html

Page 17: Using google appengine

延后调价时间到11月1日,让开发者有更多时间针对新价格体系调整自己应用;  增加免费实例时间,从24小时增加到28小时,即便应用有一些突发请求,也有可能在免费区间里

Livid: 可以有更多时间优化或是为搬走写新代码。个人对 Python 的喜欢和深入研究的决心没有动摇。动摇的是对GAE 的信心,这次决定是完全违背常识的。如打算学 Python web development,可从Flask,webapp2或Tornado上手。

keakon: 如果只是学习,GAE免费配额还能维持一个1000PV以下站点。等超过1000时,该学的也都学会了。

Page 18: Using google appengine

 

● 尽量多使用memcache

● Appengine(免费)+ VPS(每月5美金左右)

● 数据库访问通过webservice访问VPS上DB,对数据进行cache

● 搜索功能使用google或者VPS自建

● 使用VPS上的Nginx建立AppEngine反向代理,访问Appengine

  find VPS seller, coupon             http://www.lowendbox.com/   how to install Nginx in VPS             http://www.howtoforge.com/ 

Page 19: Using google appengine
Page 20: Using google appengine
Page 21: Using google appengine

Useful linkshttp://code.google.com/appengine/http://googleappengine.blogspot.com/http://www.v2ex.com/go/gaehttp://www.neopythonic.blogspot.com/http://blog.notdot.net/http://www.billkatz.com/http://www.franciscosouza.com/tag/google-app-engine/

http://code.google.com/hosting/search?q=appengine&btn=Search+projectshttps://github.com/search?q=AppEnginehttp://en.wikipedia.org/wiki/Google_App_Enginehttp://highscalability.com/google-architecturehttps://groups.google.com/forum/#!forum/google-appenginehttp://www.reddit.com/r/AppEngine/

Page 22: Using google appengine

Interesting projectshttp://code.google.com/p/googleappengine/http://code.google.com/p/appscale/ (Setup your private GAE)http://code.google.com/p/app-engine-site-creator/http://code.google.com/p/google-app-engine-samples/http://code.google.com/p/fantasm/https://github.com/metachris/feedmailerhttps://github.com/crabasa/Twitter2Mailhttp://code.google.com/p/jaikuengine/http://code.google.com/p/appengine-mapreduce/http://code.google.com/p/gae-bbs/http://code.google.com/p/rietveld/http://code.google.com/p/tipfy/http://code.google.com/p/kay-framework/https://github.com/xuming/micologhttps://github.com/livid/pickyhttps://github.com/livid/v2exhttps://github.com/seven1m/sinatra-appengine-examplemirrorrr-plus

Page 23: Using google appengine

Cloud Computing Joke

Page 24: Using google appengine

Q & A ??