_tornado.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:wdom 作者: miyakogi 项目源码 文件源码
def start_server(app: web.Application = None, port: int = None,
                 address: str = None, **kwargs: Any) -> HTTPServer:
    """Start server with ``app`` on ``localhost:port``.

    If port is not specified, use command line option of ``--port``.
    """
    app = app or get_app()
    port = port if port is not None else config.port
    address = address if address is not None else config.address

    server = app.listen(port, address=address)
    app.server = server
    server_config['address'] = address
    for sock in server._sockets.values():
        if sock.family == socket.AF_INET:
            server_config['port'] = sock.getsockname()[1]
            break
    return server
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号