• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Python在豆瓣的应用
 

Python在豆瓣的应用

on

  • 13,993 views

@ PyCon China 2011

@ PyCon China 2011

Statistics

Views

Total Views
13,993
Views on SlideShare
10,430
Embed Views
3,563

Actions

Likes
107
Downloads
625
Comments
1

15 Embeds 3,563

http://www.it168.com 2480
http://www.webguo.com 965
http://www.cnblogs.com 71
http://a0.twimg.com 16
https://twitter.com 5
http://www.softngr.org 5
http://paper.li 5
http://snapshot.soso.com 5
http://cache.baidu.com 3
http://wse.baidu.com 3
https://si0.twimg.com 1
http://nuevospowerpoints.blogspot.com 1
http://192.168.245.161 1
http://www.sunnybtoc.com 1
http://countageous.blogspot.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

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

11 of 1 previous next

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

Python在豆瓣的应用 Python在豆瓣的应用 Presentation Transcript

  • Python 应 2011.12
  • About Me• / hongqn• 2002 Python• 2004 Python• 2006 现 构师• http://www.douban.com/ people/hongqn/
  • Python and Douban
  • Python in Douban
  • 协 发环
  • 协 发环+
  • 协 发环+ +
  • 协 发环 Face to Face ++ +
  • 术团队 动 发 术 产 发QA
  • 动 发 术 产 发QA
  • Mako
  • Mako• A very fast template engine
  • Mako• A very fast template engine• Mako IS Python
  • 态 处static(): 动处 态 URL <link href="${static(/css/douban.css)}" rel="stylesheet" type="text/css">
  • 态 处static(): 动处 态 URL <link href="${static(/css/douban.css)}" rel="stylesheet" type="text/css"> 发环 http://dev.douban.com/css/douban.css
  • 态 处static(): 动处 态 URL <link href="${static(/css/douban.css)}" rel="stylesheet" type="text/css"> 发环 http://dev.douban.com/css/douban.css线 环 http://img3.douban.com/css/packed_douban9922754105.css
  • 联...html code....<script>${istatic(/js/sns/tribe/manage_members.js)|n}</script>
  • 预编译@import
  • 预编译@import pyScss
  • 动 发 术 产 发QA
  • APNS Agent
  • APNS Agent• 应 Apple Push Notification Service (APNS) 讯
  • APNS Agent• 应 Apple Push Notification Service (APNS) 讯• gevent
  • APNS Agent• 应 Apple Push Notification Service (APNS) 讯• gevent• bottle
  • APNS Agent• 应 Apple Push Notification Service (APNS) 讯• gevent• bottle• APNSWrapper
  • 动 发 术 产 发QA
  • Quixote
  • Quixote• Pretty old (we are using version 1.2)
  • Quixote• Pretty old (we are using version 1.2)• Simple
  • Quixote• Pretty old (we are using version 1.2)• Simple• Fast
  • Quixote• Pretty old (we are using version 1.2)• Simple• Fast• Stable
  • Quixote• Pretty old (we are using version 1.2)• Simple• Fast• Stable• Traversal based
  • Traversalhttp://www.douban.com/group/python/members
  • Traversalhttp://www.douban.com/group/python/members /
  • Traversalhttp://www.douban.com/group/python/members / import luz.group group
  • Traversalhttp://www.douban.com/group/python/members / import luz.group group _q_lookup(request, python) python
  • Traversalhttp://www.douban.com/group/python/members / import luz.group group _q_lookup(request, python) python .members(request) members
  • Traversalhttp://www.douban.com/group/python/members / import luz.group group _q_lookup(request, python) python ._q_access(request) .members(request) members
  • Traversalhttp://www.douban.com/group/python/members / import luz.group group raise DeletedGroupError _q_lookup(request, python)
  • Traversalhttp://www.douban.com/group/python/members / import luz.group group raise DeletedGroupError _q_lookup(request, python) _q_exception_handler(request, e)
  • Traversalhttp://www.douban.com/group/python/members / import luz.group group raise DeletedGroupError _q_lookup(request, python) _q_exception_handler(request, e) route based url dispatch 录级 进
  • Decorators@need_post@require_login@check_switch(annotation)@check_permission(admin)@jsonizedef preview(self, request):
  • Generators
  • Generatorsfeed feed feed
  • Generatorsfeed feed feed iterator iterator iterator
  • Generatorsfeed feed feed iterator iterator iterator imerge iterator
  • Generatorsfeed feed feed iterator iterator iterator imerge iterator pager list
  • Meta Programmingclass MetaPage(object): __metaclass__ = MetaObserverclass Vote(Commentable, MetaPage): kind = K_VOTE kind_name = voteassert MetaObserver.get_class_by_name(vote) is Vote
  • OneRing • Build Desktop Application Using Web Technology • HTML5 + CSS + JS • WebKit + Qt + Python
  • 动 发 术 产 发QA
  • Restful MongoDB Service• 给 业 储• django-piston• sleepy
  • 动 发 术 产 发QA
  • pylint • 码 态检查 • SQL inject 检查 • XSS 检查
  • onimaru • 错误 统 • Based on django-sentry
  • release manager • 动 tag • 认测试结 •发 线报 • django powered
  • 动 发 术 产 发QA
  • cmy - MySQL Client• MySQL 户 Python/C API编• select 语•• 访问时 python对• 时 MySQLdb
  • C++ Intergration • cos_sim load_data.pydef load(): for user, subject, rating in CmyResult( "select user_id, subject_id, rating from user_interest"): cos_sim_io.add_edge(user, subject, rating) Python 载 C++计
  • 动 发 术 产 发QA
  • Online Profiler 12164 function calls (12109 primitive calls) in 0.250 CPU secondsOrdered by: internal time, call countList reduced from 274 to 60 due to restriction <60>ncalls tottime percall cumtime percall filename:lineno(function) 1000 0.098 0.000 0.098 0.000 cmemcached.py:22(restore) 61 0.064 0.001 0.070 0.001 cmemcached.py:64(get) 14 0.026 0.002 0.121 0.009 cmemcached.py:68(get_multi) 908 0.010 0.000 0.017 0.000 decorator.py:22(gen_key) 908 0.005 0.000 0.033 0.000 decorator.py:39(_) 67 0.004 0.000 0.199 0.003 debug.py:26(_) 898 0.004 0.000 0.004 0.000 format.py:57(_) 953 0.003 0.000 0.095 0.000 cmemcached.py:70(<genexpr>) 1 0.003 0.003 0.149 0.149 __init__.py:1866(get_loc_period_events) 908 0.002 0.000 0.007 0.000 format.py:10(format) 2 0.002 0.001 0.143 0.071 __init__.py:346(gets) 963 0.002 0.000 0.075 0.000 wrapper.py:138(get) 67 0.001 0.000 0.001 0.000 debug.py:36(format_call) 878 0.001 0.000 0.001 0.000 __init__.py:1240(is_published) 8 0.001 0.000 0.128 0.016 wrapper.py:146(get_multi) 233 0.001 0.000 0.001 0.000 cgi.py:1031(escape)
  • DoubanService• thrift RPC 务• PasteScript实现 码 务• https://github.com/twitter/thrift_client Python 负载 failover• nagios munin 监
  • Dpark• 计• Modeled after Spark, but using Python• mesos实现资 调 dpark = DparkContext() rdd = dpark.textFile(filepath) def filter(line): return pattern in line for line in rdd.filter(filter).collect(): sys.stdout.write(line)
  • pypcap + dpkt • Warm up MySQL slaves • Analyze MySQL issue with real- time queries
  • DAE• Modeled after Google AppEngine, but for internal use only• virtualenv to manage dependencies• gunicorn + gevent• Best practice built-in• Developing...
  • 编 语 in
  • 编 语 in
  • 编 语 in
  • 编 语 in
  • 编 语 in
  • 编 语 in
  • 编 语 in
  • 编 语 in
  • Q &A
  • Thanks