Example #1
0
def runserver(host, port):
    """Setups params and run server.

    Args:
        host (str): Host where server will be running.
        port (str): Port where server will be running.

    """
    app.run(host=host, port=port)
Example #2
0
def runserver(host, port):
    for k, v in os.environ.items():
        if k.startswith(SANIC_PREFIX):
            _, config_key = k.split(SANIC_PREFIX, 1)
            app.config[config_key] = v

    migrate_wrapper()

    class CGDPHttpProtocol(HttpProtocol):
        def __init__(self, *args, **kwargs):
            if "request_timeout" in kwargs:
                kwargs.pop("request_timeout")
            super().__init__(*args, request_timeout=300, **kwargs)

    app.run(host=host, port=port, protocol=CGDPHttpProtocol, debug=True)
Example #3
0
import argparse

from service_api.app import app

parser = argparse.ArgumentParser()
parser.add_argument('--host',
                    help='Setup host ip to listen up, default to 0.0.0.0',
                    default='0.0.0.0')
parser.add_argument('--port',
                    help='Setup port to attach, default to 8008',
                    default='8008')
parser.add_argument('--workers',
                    help='Setup workers to run, default to 1',
                    type=int,
                    default=1)
parser.add_argument('--debug', help='Enable or disable debugging')
args = parser.parse_args()

if __name__ == '__main__':
    app.run(
        host=args.host,
        port=args.port,
        workers=args.workers,
        debug=args.debug,
    )
Example #4
0
def runserver(host, port, debug):
    app.run(host=host, port=port, debug=debug)
Example #5
0
def runserver(host='0.0.0.0'):
    app.run(host='0.0.0.0',
            port=int(os.environ.get('PORT', 8000)),
            workers=int(os.environ.get('WEB_CONCURRENCY', 1)),
            debug=bool(os.environ.get('DEBUG', '')))
Example #6
0
def runserver(host, port):
    app.run(host=host, port=port, debug=True)