Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ZHGDG_HOA.9_Py的困惑和突破
Search
Zoom.Quiet
August 18, 2014
Technology
370
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ZHGDG_HOA.9_Py的困惑和突破
https://plus.google.com/events/con5s3ensppq7vtf59aeffme8oo
Zoom.Quiet
August 18, 2014
More Decks by Zoom.Quiet
See All by Zoom.Quiet
PyCon2014China-Zhuhai-high performance
zoomquiet
0
200
PyCon2014China-Zhuhai-meta programming
zoomquiet
1
180
PyCon2014China-Zhuhai-bpm.py
zoomquiet
0
150
PyCon2014China-Zhuhai-luna kv db
zoomquiet
0
150
PyCon2014China-Zhuhai-seed studio
zoomquiet
0
140
PyCon2014China-Zhuhai-Docker Registry Build By Python
zoomquiet
0
160
PyCon2014China-Zhuhai-jeff
zoomquiet
0
150
PyCon2014China-Zhuhai-pythonic front-end
zoomquiet
0
180
DevFest2014-Zhuhai-Polymer
zoomquiet
0
480
Other Decks in Technology
See All in Technology
なぜ、あなたのAPIは使われないのか? AX時代の設計原則、ガードレール、運用体制
yokawasa
1
190
Kaggleで成長するために意識したこと
prgckwb
2
440
[2026-07-15] AI Ready なはずだったアーキテクチャと、見えてきた課題・次に目指す状態
wxyzzz
11
4.1k
現場との対話から始める “作る前に問い直す”業務改善
mochico50
1
150
Data + AI Summit 2026 イベントレポート: 「AIがビジネスで意思決定するデータ基盤」へ
nek0128
0
300
「早く出す」より「事業に効く」 ── 顧客の業務サイクルから逆算するAI時代の二重ループ開発と「変化の設計者」 / devsumi2026
rakus_dev
1
560
AI時代のYAGNI:「爆速で無駄になった機能」からの学び / 20260720 Naoki Takahashi
shift_evolve
PRO
3
490
Jitera Company Deck
jitera
0
250
AIが実装を自走する時代の認知負債との戦い
lycorptech_jp
PRO
2
1k
Webアプリ認証の全体像 / The Big Picture of Web App Authentication
kitano_yuichi
1
400
誤解だらけの開発生産性 / Myths and Misconceptions about Developer Productivity
i35_267
2
960
伝票作成AIエージェントを支える、LLMOpsとインフラの選択肢 / AICon2026_takeda
rakus_dev
0
250
Featured
See All Featured
It's Worth the Effort
3n
188
29k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.5k
Paper Plane (Part 1)
katiecoart
PRO
1
9.7k
Done Done
chrislema
186
16k
The Curse of the Amulet
leimatthew05
2
13k
Google's AI Overviews - The New Search
badams
0
1.1k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
890
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
610
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.9k
Skip the Path - Find Your Career Trail
mkilby
1
170
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
62
45k
Transcript
Python Web Dev 的困惑与突破 http://laiyonghao.com 2014.8.16
who?
who? 赖勇浩
9+年
geme->webgame->web
彩票 电话、自助终端、互联网 创业者
珠三角技术沙龙 创始人、组委
PyCon China 2011、2012、2013
库、框架、程序、插件
库 重用、减量
框架 制定规范
程序 功能、服务
插件 扩展 功能、服务
插件的麻烦 机制、协议
框架对插件机制的支持
None
subapplications
blog.py import web urls = (
"", "reblog", "/(.*)", "blog" ) class reblog: def GET(self): raise web.seeother('/') class blog: def GET(self, path): return "blog " + path app_blog = web.application(urls, locals())
main.py import web import blog urls =
( "/blog", blog.app_blog, "/(.*)", "index" ) class index: def GET(self, path): return "hello " + path app = web.application(urls, locals()) if __name__ == "__main__": app.run()
Blueprints
simple_page.py from flask import Blueprint, render_template, abort from
jinja2 import TemplateNotFound simple_page = Blueprint('simple_page', __name__, template_folder='templates') @simple_page.route('/', defaults={'page': 'index'}) @simple_page.route('/<page>') def show(page): try: return render_template('pages/%s.html' % page) except TemplateNotFound: abort(404)
main.py from flask import Flask from yourapplication.simple_page import
simple_page app = Flask(__name__) app.register_blueprint(simple_page)
INSTALLED_APPS
settings.py INSTALLED_APPS = [ 'anthology.apps.GypsyJazzConfig',
# ... ]
Extensible applications
main.py if __name__ == '__main__':
config.scan('someotherpackage') config.add_view('mypackage.views.myview', name='myview')
Overriding Views def configure_views(config): config.add_view('theoriginalapp.views.theview',
name='theview') --------------------------------------------------- from pyramid.config import Configurator from originalapp import configure_views if __name == '__main__': config = Configurator() config.include(configure_views) config.add_view('theoverrideapp.views.theview', name='theview')
困惑 这么多优秀的框架,为什么 Python不像PHP那么流行?
谁为Python代言?
谁为Python代言?
谁为PHP代言?
None
wordpress的成功 解决方案、插件
大胆的设想 Python缺的不是框架,是解决方 案。
解决方案的特点
解决方案的特点 是个方案 能解决问题(业务需求)
那,来个业务需求? 建个站?
None
None
每当世界陷入混乱…… 新的英雄应运而生。
WA,天生哇哇哇! 但WA不是英雄,只是一个
WA Flask based 动态装卸的插件机制
从业务中来 企业建站 微信公众号建设 电话、互联网销售彩票
setup.py entry_points=""" #
-*- Entry points: -*- [wa.plugin] wa_admin=wa.plugins.admin.pluginimpl:PluginImpl """,
plugin interface class PluginInterface(object): def
__init__(self, config): self._config = config def blueprints(self): ''' Return all blueprints this plugin contained. ''' raise NotImplemented()
get/scan plugin(s) import pkg_resources class PluginFinder(object):
def __init__(self, group, name=None):… def all_plugins(self, filter=None): if filter: for i in pkg_resources.iter_entry_points(self._group, self._name): if filter(i): yield i.load() else: … def plugin(self, prj, name): return pkg_resources.load_entry_point(prj, self._group, name)
plugin impl from flask import Blueprint from wa.plugin
import PluginInterface admin = Blueprint('admin', __name__, static_folder='../static’, template_folder='../templates') class PluginImpl(PluginInterface): def __init__(self, config): PluginInterface.__init__(self, config) def blueprints(self): return [ (index, {'url_prefix':'/index'}), ]
settings.py WA_ENTRY_PLUGIN = 'wa_admin'
实例1
实例2
早期版本 https://github.com/laiyonghao/wa
广告
谢谢大家! end.