Google App Engine Devfest 200810 External

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Favorite

    Google App Engine Devfest 200810 External - Presentation Transcript

    1.  
    2. Google App Engine 快速入门 2008 年 10 月 24 日
    3. 日程
      • App Engine 简介
      • 应用开发详例
      • APIs 例子
      • 其他用例和展望
    4. 基本概念
    5. 创建一个 Web 应用,往往需要自己干很多体力活…
    6. Google 提供的成套解决方案
    7. 开箱即用 , 易上手
    8. 应用详例
    9. 我们要开发 :
      • 从 twitter 获取带有某个关键字的所有 “ tweet”, 算出在此话题内发言最多的用户
      • 为每个用户生成一个总结页面 , 包括此用户的头像 , 基本资料 , 还有在这个话题下的总结页面 .
      http:// tag080808 .appspot.com
    10. 0. 注册 App Engine
      • Google App Engine: http://appengine.google.com
      • 如果无法接收短信验证码 : http://appengine.google.com/waitlist/sms_issues
    11. 1. app.yaml 配置文件 application: tag080808 version: 2 runtime: python api_version: 1 handlers: - url: /static static_dir: static - url: /admin.* script: admin.py login: admin - url: /.* script: main.py
    12. from google.appengine.ext import db class Tweet (db. Model ): text = db. StringProperty () id = db. IntegerProperty () from_user = db. StringProperty () created_at = db. DateTimeProperty () iso_language_code = db. StringProperty () profile_image_url = db. LinkProperty () class User (db. Model ): name = db. StringProperty () screen_name = db. StringProperty () followers_count = db. IntegerProperty () count = db. IntegerProperty () id = db. IntegerProperty () description = db. StringProperty () ... 2. Data Model
    13. 3. 后台抓取数据 class FetchHandler(webapp.RequestHandler): def get(self): url =( "http://search.twitter.com/search.json?q=%%23080808" "&page=%d" % page) response = urlfetch.fetch(url) if response.status_code == 200 : data = simplejson.loads(response.content) results = data[ "results" ] for result in results tweet = datamodel.Tweet( id = result[ "id" ], from_user = result[ "from_user" ], text = result[ "text" ], created_at = parse_time(result[ "created_at" ]) ) tweet.put() ......
    14. class DefaultPage(webapp.RequestHandler): def get(self): top_users = datamodel.User.gql("ORDER BY count DESC LIMIT 20") template_values = {"top_users": to p_users} path = os.path.join(os.path.dirname(__file__), "templates/default.html") self.response.headers["Content-Type"] = "text/html" self.response.out.write(template.render(path, template_values)) 4 . 排行榜显示页面
    15. class DefaultPage(webapp.RequestHandler): def get(self): top_users = datamodel.User.gql("ORDER BY count DESC LIMIT 20") template_values = { "top_users": top_users } path = os.path.join(os.path.dirname(__file__), "templates/default.html") self.response.headers["Content-Type"] = "text/html" self.response.out.write(template.render(path, template_values)) 4 . 排行榜显示页面
    16. class DefaultPage(webapp.RequestHandler): def get(self): if memcache.get("top_users") is None: top_users = datamodel.User.gql("ORDER BY count DESC LIMIT 20") memcache.set("top_users", simplejson.dumps(top_users)) else: top_users = memcache.get("top_users") template_values = { "top_users": top_users } path = os.path.join(os.path.dirname(__file__), "templates/default.html") self.response.headers["Content-Type"] = "text/html" self.response.out.write(template.render(path, template_values)) 4 . 排行榜显示页面
    17. <!DOCTYPE html> <html> ... <body> ... {% for user in top_users %} <dl> <dt><a href=“/tweeter/{{ user.user }}”>{{ user.name }}</a></dt> < dd >{{user.count }}</dd> </dl> {% endfor %} ... </body> 5. HTML 模板 default.html
    18. 6. 开发调试环境
    19. 7. 部署! appcfg.py update application_folder
    20. http:// tag080808 .appspot.com 或者使用自己的域名 ! http:// me.tag080808.com
    21. 8. 监测自己的应用
    22. 其它 APIs
    23. Memcache API 为常用页面和数据库查询加速 Mail API 自动发送邮件 URL Fetch API 抓取其他互联网资源 Users API 与 Google 账户轻易整合 Images API 基本图片处理
    24. zhen-gong-fu.appspot.com code.google.com/p/zhen-gong-fu
    25. 其它应用与展望未来
    26. 和 Google Apps 的整合 Map.yuanpei.org
    27. Google App Engine + OpenSocial TBD: Focus on 是男人系列 http://code.google.com/apis/opensocial/ articles/appengine-0.8.html
    28. Google App Engine + OpenSocial TBD: Focus on 是男人系列
    29. PREVIEW
      • 现状…
      • 500 MB 存储空间
      • 每天 2 GB 流量
      • 大约可容纳每月 500 万的访问量
      • 未来可付费升级
      • 未来 …
      • 大文件存取
      • 大批量数据上传和导出工具
      • 付费 : 可购买更多配额
      • 更多语言的支持
      • 运行状况监控站点
    30. 教程、文档、资源、精品文章… http://code.google.com/appengine 作品展示… http://appgallery.appspot.com/ 示例代码下载… http://code.google.com/p/google-app-engine-samples/
    31. 谢谢 !

    + junyujunyu, 2 years ago

    custom

    693 views, 1 favs, 0 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 693
      • 693 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 1
    • Downloads 17
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories