Skip to content

Web booster

start_web_server(**kwargs)

Start func of flask server(on windows platform) or gunicorn server(on others). Accept input arguments to overwrite default gunicorn config.

Source code in agentuniverse/agent_serve/web/web_booster.py
Python
def start_web_server(**kwargs):
    """Start func of flask server(on windows platform) or gunicorn server(on
    others). Accept input arguments to overwrite default gunicorn config."""
    if sys.platform.startswith('win'):
        from .flask_server import app
        if 'bind' in kwargs:
            host, port = kwargs['bind'].split(':')
            port = int(port)
        else:
            port = 8888
            host = '0.0.0.0'
        app.run(port=port, host=host, debug=False)
    else:
        from .gunicorn_server import GunicornApplication
        GunicornApplication().update_config(kwargs)
        GunicornApplication().run()