Python waitress.serve() Examples

The following are 7 code examples of waitress.serve(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module waitress , or try the search function .
Example #1
Source File: test_init.py    From pledgeservice with Apache License 2.0 5 votes vote down vote up
def _callFUT(self, app, **kw):
        from waitress import serve
        return serve(app, **kw) 
Example #2
Source File: testutils.py    From requests-unixsocket with Apache License 2.0 5 votes vote down vote up
def run(self):
        logger.debug('Call waitress.serve in %r ...', self)
        wsgi_app = WSGIApp()
        server = waitress.create_server(wsgi_app, unix_socket=self.usock)
        wsgi_app.server = server
        self.server = server
        self.server_ready_event.set()
        server.run() 
Example #3
Source File: app.py    From matrix-registration with MIT License 5 votes vote down vote up
def run_server(info):
    app = info.load_app()
    Limiter(
        app,
        key_func=get_ipaddr,
        default_limits=config.config.rate_limit
    )
    if config.config.allow_cors:
        CORS(app)
    serve(app, host=config.config.host, port=config.config.port) 
Example #4
Source File: puffin.py    From puffin with GNU Affero General Public License v3.0 5 votes vote down vote up
def server(reload=False):
    "Run the server"
    if reload:
        reload_module.reload_me("server")
    else:
        waitress.serve(app, host=app.config["HOST"], port=app.config["PORT"],
                threads=app.config["THREADS"]) 
Example #5
Source File: japonicus.py    From japonicus with MIT License 5 votes vote down vote up
def launchWebEvolutionaryInfo():
    print("WEBSERVER MODE")
    webpageTitle = "japonicus evolutionary statistics - v%.2f" % VERSION
    webApp, webServer = promoterz.webServer.core.build_server(webpageTitle)

    webServerProcess = Thread(
        target=waitress.serve,
        kwargs={
            "app": webServer,
            "listen": "0.0.0.0:8182"
        }
    )

    webServerProcess.start()
    return webApp 
Example #6
Source File: waitress_server.py    From pywebdriver with GNU General Public License v3.0 5 votes vote down vote up
def main():
    # waitress configuration
    kwargs = {}
    for option, value  in conf.items('waitress'):
        kwargs[option] = value
    waitress.serve(pywebdriver.app, **kwargs)

# Run application 
Example #7
Source File: runner.py    From pledgeservice with Apache License 2.0 4 votes vote down vote up
def run(argv=sys.argv, _serve=serve):
    """Command line runner."""
    name = os.path.basename(argv[0])

    try:
        kw, args = Adjustments.parse_args(argv[1:])
    except getopt.GetoptError as exc:
        show_help(sys.stderr, name, str(exc))
        return 1

    if kw['help']:
        show_help(sys.stdout, name)
        return 0

    if len(args) != 1:
        show_help(sys.stderr, name, 'Specify one application only')
        return 1

    try:
        module, obj_name = match(args[0])
    except ValueError as exc:
        show_help(sys.stderr, name, str(exc))
        return 1

    # Add the current directory onto sys.path
    sys.path.append(os.getcwd())

    # Get the WSGI function.
    try:
        app = resolve(module, obj_name)
    except ImportError:
        show_help(sys.stderr, name, "Bad module '{0}'".format(module))
        return 1
    except AttributeError:
        show_help(sys.stderr, name, "Bad object name '{0}'".format(obj_name))
        return 1
    if kw['call']:
        app = app()

    # These arguments are specific to the runner, not waitress itself.
    del kw['call'], kw['help']

    _serve(app, **kw)
    return 0