本文整理汇总了Python中tornado.web.Application.sockets方法的典型用法代码示例。如果您正苦于以下问题:Python Application.sockets方法的具体用法?Python Application.sockets怎么用?Python Application.sockets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tornado.web.Application
的用法示例。
在下文中一共展示了Application.sockets方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start_server
# 需要导入模块: from tornado.web import Application [as 别名]
# 或者: from tornado.web.Application import sockets [as 别名]
def start_server(site_, port):
global site, app
site = site_
if site.base_url != '/':
handlers = [(r'/', RedirectHandler, {'url': site.base_url, 'permanent': False})]
else:
handlers = []
handlers.extend([
(r'/__reload.js', ReloadJSHandler),
(r'/__reload__/', ReloadHandler),
(site.base_url + r'(.*)', NoCacheFileHandler),
])
app = Application(handlers, debug=True)
app.sockets = set()
app.listen(port)
loop = IOLoop.current()
send.loop = loop
send.sockets = app.sockets
loop.start()
示例2: init_server
# 需要导入模块: from tornado.web import Application [as 别名]
# 或者: from tornado.web.Application import sockets [as 别名]
def init_server(runner_, port, use_plim, static_file_dir):
global app, runner
settings = dict(
debug=True,
# autoreload=True,
)
app = Application([
(r'/', IndexHandler),
(r'/start/', StartHandler),
(r'/stop/', StopHandler),
(r'/messages/', MessageHandler),
(r'.*/quipclient.py$', QuipClientHandler),
(r'/(.*\.pyj)$', PyJHandler),
(r'/(.*\.styl)$', StylusHandler),
(r'/(.*)', NoCacheStaticFileHandler),
], **settings)
runner = runner_
app.sockets = set()
app.use_plim = use_plim
app.static_file_dir = static_file_dir
app.listen(port)
# Return the sockets so that the runner can use them.
return app.sockets