本文整理汇总了Python中tornado.httpserver.HTTPServer.listen方法的典型用法代码示例。如果您正苦于以下问题:Python HTTPServer.listen方法的具体用法?Python HTTPServer.listen怎么用?Python HTTPServer.listen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tornado.httpserver.HTTPServer
的用法示例。
在下文中一共展示了HTTPServer.listen方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: listen
# 需要导入模块: from tornado.httpserver import HTTPServer [as 别名]
# 或者: from tornado.httpserver.HTTPServer import listen [as 别名]
def listen(self, port, address="", **kwargs):
"""为应用程序在给定端口上启动一个HTTP server.
这是一个方便的别名用来创建一个 `.HTTPServer` 对象并调用它
的listen方法. `HTTPServer.listen <.TCPServer.listen>`
不支持传递关键字参数给 `.HTTPServer` 构造器. 对于高级用途
(e.g. 多进程模式), 不要使用这个方法; 创建一个
`.HTTPServer` 并直接调用它的
`.TCPServer.bind`/`.TCPServer.start` 方法.
注意在调用这个方法之后你仍然需要调用
``IOLoop.current().start()`` 来启动该服务.
返回 `.HTTPServer` 对象.
.. versionchanged:: 4.3
现在返回 `.HTTPServer` 对象.
"""
# import is here rather than top level because HTTPServer
# is not importable on appengine
from tornado.httpserver import HTTPServer
server = HTTPServer(self, **kwargs)
server.listen(port, address)
return server
示例2: listen
# 需要导入模块: from tornado.httpserver import HTTPServer [as 别名]
# 或者: from tornado.httpserver.HTTPServer import listen [as 别名]
def listen(self, port: int, address: str = "", **kwargs: Any) -> HTTPServer:
"""Starts an HTTP server for this application on the given port.
This is a convenience alias for creating an `.HTTPServer`
object and calling its listen method. Keyword arguments not
supported by `HTTPServer.listen <.TCPServer.listen>` are passed to the
`.HTTPServer` constructor. For advanced uses
(e.g. multi-process mode), do not use this method; create an
`.HTTPServer` and call its
`.TCPServer.bind`/`.TCPServer.start` methods directly.
Note that after calling this method you still need to call
``IOLoop.current().start()`` to start the server.
Returns the `.HTTPServer` object.
.. versionchanged:: 4.3
Now returns the `.HTTPServer` object.
"""
server = HTTPServer(self, **kwargs)
server.listen(port, address)
return server
示例3: listen
# 需要导入模块: from tornado.httpserver import HTTPServer [as 别名]
# 或者: from tornado.httpserver.HTTPServer import listen [as 别名]
def listen(self, port, address="", **kwargs):
"""Starts an HTTP server for this application on the given port.
This is a convenience alias for creating an `.HTTPServer`
object and calling its listen method. Keyword arguments not
supported by `HTTPServer.listen <.TCPServer.listen>` are passed to the
`.HTTPServer` constructor. For advanced uses
(e.g. multi-process mode), do not use this method; create an
`.HTTPServer` and call its
`.TCPServer.bind`/`.TCPServer.start` methods directly.
Note that after calling this method you still need to call
``IOLoop.instance().start()`` to start the server.
"""
# import is here rather than top level because HTTPServer
# is not importable on appengine
from tornado.httpserver import HTTPServer
server = HTTPServer(self, **kwargs)
server.listen(port, address)
示例4: listen
# 需要导入模块: from tornado.httpserver import HTTPServer [as 别名]
# 或者: from tornado.httpserver.HTTPServer import listen [as 别名]
def listen(self, port, address="", **kwargs):
"""Starts an HTTP server for this application on the given port.
This is a convenience alias for creating an `.HTTPServer`
object and calling its listen method. Keyword arguments not
supported by `HTTPServer.listen <.TCPServer.listen>` are passed to the
`.HTTPServer` constructor. For advanced uses
(e.g. multi-process mode), do not use this method; create an
`.HTTPServer` and call its
`.TCPServer.bind`/`.TCPServer.start` methods directly.
Note that after calling this method you still need to call
``IOLoop.current().start()`` to start the server.
Returns the `.HTTPServer` object.
.. versionchanged:: 4.3
Now returns the `.HTTPServer` object.
"""
# import is here rather than top level because HTTPServer
# is not importable on appengine
from tornado.httpserver import HTTPServer
server = HTTPServer(self, **kwargs)
server.listen(port, address)
return server
示例5: listen
# 需要导入模块: from tornado.httpserver import HTTPServer [as 别名]
# 或者: from tornado.httpserver.HTTPServer import listen [as 别名]
def listen(self, port, address="", **kwargs):
"""Starts an HTTP server for this application on the given port.
This is a convenience alias for creating an HTTPServer object
and calling its listen method. Keyword arguments not
supported by HTTPServer.listen are passed to the HTTPServer
constructor. For advanced uses (e.g. preforking), do not use
this method; create an HTTPServer and call its bind/start
methods directly.
Note that after calling this method you still need to call
IOLoop.instance().start() to start the server.
"""
# import is here rather than top level because HTTPServer
# is not importable on appengine
from tornado.httpserver import HTTPServer
server = HTTPServer(self, **kwargs)
server.listen(port, address)