web_api.py 文件源码

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

项目:sawtooth-validator 作者: hyperledger-archives 项目源码 文件源码
def initialize_web_server(config, validator):
    # Parse the listen directives from the configuration so
    # we know what to bind HTTP protocol to
    listen_directives = parse_listen_directives(config)

    if 'http' in listen_directives:
        static_dir = os.path.join(
            os.path.dirname(os.path.abspath(__file__)), "static_content")

        site = ApiSite(RootPage(validator, static_dir))
        interface = listen_directives['http'].host
        if interface is None:
            interface = ''
        LOGGER.info(
            "listen for HTTP requests on (ip='%s', port=%s)",
            interface,
            listen_directives['http'].port)
        reactor.listenTCP(
            listen_directives['http'].port,
            site,
            interface=interface)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号