示例#1
0
文件: app.py 项目: Mellanox/fuel-web
def run_server(func, server_address=('0.0.0.0', 8080)):
    """This function same as runsimple from web/httpserver
    except removed LogMiddleware because we use
    HTTPLoggerMiddleware instead
    """
    server = WSGIServer(server_address, func)
    print('http://%s:%d/' % server_address)

    try:
        server.start()
    except (KeyboardInterrupt, SystemExit):
        server.stop()
示例#2
0
文件: app.py 项目: koder-ua/fuel-web
def run_server(func, server_address=('0.0.0.0', 8080)):
    """This function same as runsimple from web/httpserver
    except removed LogMiddleware because we use
    HTTPLoggerMiddleware instead
    """
    server = WSGIServer(server_address, func)
    print('http://%s:%d/' % server_address)

    for hook in hooks(INGBackgroundTask):
        threading.Thread(None, hook.run)

    try:
        server.start()
    except (KeyboardInterrupt, SystemExit):
        server.stop()
    finally:
        for hook in hooks(INGBackgroundTask):
            hook.stop()
示例#3
0
    def startserver(o, func, port):
        from web.httpserver import WSGIServer, StaticMiddleware
        func = StaticMiddleware(func)
        func = MyLogMiddleware(func)

        o.server = WSGIServer(("0.0.0.0", port), func)

        log().info("Web interface listening on http://0.0.0.0:%d/" % port)

        o.server.start()
示例#4
0
文件: wsgi.py 项目: mahak/fuelweb
def run_server(func, server_address=('0.0.0.0', 8080)):
    """
    This function same as runsimple from web/httpserver
    except removed LogMiddleware because we use
    HTTPLoggerMiddleware instead
    """
    global server
    func = StaticMiddleware(func)
    server = WSGIServer(server_address, func)
    print 'http://%s:%d/' % server_address

    try:
        server.start()
    except (KeyboardInterrupt, SystemExit):
        server.stop()
示例#5
0
def pro(port):
    # run cherrypy 'production' server
    print "Running server on port", str(port)
    print "Quit the server with CTRL-BREAK"

    import django.core.handlers.wsgi
    from web.httpserver import WSGIServer, StaticMiddleware, LogMiddleware

    os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
    func = django.core.handlers.wsgi.WSGIHandler()
    func = StaticMiddleware(func)
    func = LogMiddleware(func)

    server = WSGIServer(('localhost', port), func)
    server.timeout = 50

    try:
        server.start()
    except KeyboardInterrupt:
        server.stop()
示例#6
0
def pro(port):
    # run cherrypy 'production' server
    print "Running server on port",str(port)
    print "Quit the server with CTRL-BREAK"
    
    import django.core.handlers.wsgi
    from web.httpserver import WSGIServer, StaticMiddleware, LogMiddleware
    
    os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
    func = django.core.handlers.wsgi.WSGIHandler()
    func = StaticMiddleware(func)
    func = LogMiddleware(func)

    server = WSGIServer(('localhost', port), func)
    server.timeout = 50

    try:
        server.start()
    except KeyboardInterrupt:
        server.stop()