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)
web_api.py 文件源码
python
阅读 20
收藏 0
点赞 0
评论 0
评论列表
文章目录