def launch(app_name, port, paste_config_file, data={}, host='0.0.0.0', backlog=128, threads=1000): """Launches a wsgi server based on the passed in paste_config_file. Launch provides a easy way to create a paste app from the config file and launch it via the service launcher. It takes care of all of the plumbing. The only caveat is that the paste_config_file must be a file that paste.deploy can find and handle. There is a helper method in cfg.py that finds files. Example: conf_file = CONF.find_file(CONF.api_paste_config) launcher = wsgi.launch('myapp', CONF.bind_port, conf_file) launcher.wait() """ app = pastedeploy.paste_deploy_app(paste_config_file, app_name, data) server = openstack_wsgi.Service(app, port, host=host, backlog=backlog, threads=threads) return service.launch(server)
def initialize_reddwarf(config_file): from reddwarf.openstack.common import pastedeploy cfg.CONF(args=[], project='reddwarf', default_config_files=[config_file]) CONF.use_stderr = False CONF.log_file = 'rdtest.log' logging.setup(None) CONF.bind_port = 8779 CONF.fake_mode_events = 'simulated' return pastedeploy.paste_deploy_app(config_file, 'reddwarf', {})
def launch(app_name, port, paste_config_file, data={}, host="0.0.0.0", backlog=128, threads=1000, workers=None): """Launches a wsgi server based on the passed in paste_config_file. Launch provides a easy way to create a paste app from the config file and launch it via the service launcher. It takes care of all of the plumbing. The only caveat is that the paste_config_file must be a file that paste.deploy can find and handle. There is a helper method in cfg.py that finds files. Example: conf_file = CONF.find_file(CONF.api_paste_config) launcher = wsgi.launch('myapp', CONF.bind_port, conf_file) launcher.wait() """ app = pastedeploy.paste_deploy_app(paste_config_file, app_name, data) server = openstack_wsgi.Service(app, port, host=host, backlog=backlog, threads=threads) return service.launch(server, workers)