首页
注册
登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请
登录
Tornado Documentation
›
http://www.v2ex.com/tornado/
Tornado on GitHub
›
https://github.com/facebook/tornado/
Tornado Gists
›
http://tornadogists.org/
V2EX
›
Tornado
Tornado有没有动态API注册机制
cabinw
·
2013-01-08 10:27:01 +08:00
· 4409 次点击
这是一个创建于 4134 天前的主题,其中的信息可能已经有所发展或是发生改变。
有时候想添加几个工具型API,很简单,但是操作有点烦,要改写router,还要重启服务。
有没有项目能做到动态添加的,比如写个xml的mainifest,加入python代码,放入指定目录就能动态添加的
添加
API
动态
2 条回复
•
1970-01-01 08:00:00 +08:00
1
spritevan
2013-01-08 11:26:21 +08:00
重启是必须的吧,不管是手动还是 autoreload
@
binux
同学的做法是遍历 handlers 目录里的 *.py 文件,把里面注册的 handlers 合并后 扔给 Applicaton.__init__() 启动
也有用装饰器写 router 的
http://www.cnblogs.com/tonyseek/archive/2011/05/27/2062227.html
2
cabinw
OP
2013-01-08 11:38:43 +08:00
@
spritevan
好资料,Thanks!
关于
·
帮助文档
·
博客
·
API
·
FAQ
·
我们的愿景
·
实用小工具
·
2021 人在线
最高记录 6543
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 24ms ·
UTC 16:11
·
PVG 00:11
·
LAX 09:11
·
JFK 12:11
Developed with
CodeLauncher
♥ Do have faith in what you're doing.