Ejemplo n.º 1
0
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()
Ejemplo n.º 2
0
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()
Ejemplo n.º 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()
Ejemplo n.º 4
0
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()
Ejemplo n.º 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()
Ejemplo n.º 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()