tenant_webapp.py 文件源码

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

项目:python-keylime 作者: mit-ll 项目源码 文件源码
def main(argv=sys.argv):
    """Main method of the Tenant Webapp Server.  This method is encapsulated in a function for packaging to allow it to be 
    called as a function by an external program."""

    config = ConfigParser.SafeConfigParser()
    config.read(common.CONFIG_FILE)

    webapp_port = config.get('general', 'webapp_port')

    logger.info('Starting Tenant WebApp (tornado) on port ' + webapp_port + ', use <Ctrl-C> to stop')

    app = tornado.web.Application([
        (r"/", MainHandler),                      
        (r"/webapp/.*", WebAppHandler),
        (r"/v2/nodes/.*", InstancesHandler),
        (r'/static/(.*)', tornado.web.StaticFileHandler, {'path': "static/"}),
        ])


    # WebApp Server TLS 
    server_context = tenant_templ.get_tls_context()
    server_context.check_hostname = False # config.getboolean('general','tls_check_hostnames')
    server_context.verify_mode = ssl.CERT_NONE # ssl.CERT_REQUIRED

    # Set up server 
    server = tornado.httpserver.HTTPServer(app,ssl_options=server_context)
    server.bind(int(webapp_port), address='0.0.0.0')
    server.start(config.getint('cloud_verifier','multiprocessing_pool_num_workers')) 

    try:
        tornado.ioloop.IOLoop.instance().start()
    except KeyboardInterrupt:
        tornado.ioloop.IOLoop.instance().stop()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号