zoe_api.web.web_init

Here are the examples of the python api zoe_api.web.web_init taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

Example 1

Project: zoe Source File: entrypoint.py
def zoe_web_main() -> int:
    """
    This is the entry point for the Zoe Web script.
    :return: int
    """
    config.load_configuration()
    args = config.get_conf()
    if args.debug:
        logging.basicConfig(level=logging.DEBUG, format=LOG_FORMAT)
    else:
        logging.basicConfig(level=logging.INFO, format=LOG_FORMAT)

    if config.get_conf().auth_type == 'ldap' and not zoe_api.auth.ldap.LDAP_AVAILABLE:
        log.error("LDAP authentication requested, but 'pyldap' module not installed.")
        return 1

    zoe_api.db_init.init()

    api_endpoint = zoe_api.api_endpoint.APIEndpoint()

    app_settings = {
        'static_path': os.path.join(os.path.dirname(__file__), "web", "static"),
        'template_path': os.path.join(os.path.dirname(__file__), "web", "templates"),
        # 'debug': args.debug
    }
    app = Application(zoe_api.web.web_init(api_endpoint) + zoe_api.rest_api.api_init(api_endpoint), **app_settings)
    JinjaApp.init_app(app)

    log.info("Starting HTTP server...")
    http_server = HTTPServer(app)
    http_server.bind(args.listen_port, args.listen_address)
    http_server.start(num_processes=1)

    retry_cb = PeriodicCallback(api_endpoint.retry_submit_error_executions, 30000)
    retry_cb.start()
    retry_cb = PeriodicCallback(api_endpoint.cleanup_dead_executions, 60000)
    retry_cb.start()

    try:
        IOLoop.current().start()
    except KeyboardInterrupt:
        print("CTRL-C detected, terminating")

    return 0