Ejemplo n.º 1
0
def main(host=None, port=None):
    host = host or cfg['micropsi2']['host']
    port = port or cfg['micropsi2']['port']
    server = cfg['micropsi2']['server']
    print("Starting App on Port " + str(port))
    runtime.initialize()
    run(micropsi_app, host=host, port=port, quiet=True, server=server)
Ejemplo n.º 2
0
def main(host=None, port=None, console=True):
    host = host or cfg['micropsi2']['host']
    port = port or cfg['micropsi2']['port']
    print("Starting app on port %s, serving for %s" % (str(port), str(host)))

    # register our own signal handlers first.
    import threading
    if threading.current_thread() == threading.main_thread():
        import signal
        signal.signal(signal.SIGINT, signal_handler)
        signal.signal(signal.SIGTERM, signal_handler)
        signal.signal(signal.SIGABRT, signal_handler)

    # start the console if desired
    if console:
        try:
            import IPython
            import ipykernel
            start_ipython_console(host)
        except ImportError as err:
            print("Warning: IPython console not available: " + err.msg)
    else:
        print("Starting without ipython console")

    # init the runtime
    runtime.initialize()

    # start the webserver
    try:
        from cherrypy import wsgiserver
        server = 'cherrypy'
        kwargs = {'numthreads': 30}
    except ImportError:
        server = 'wsgiref'
        kwargs = {}

    run(micropsi_app, host=host, port=port, quiet=True, server=server, **kwargs)
Ejemplo n.º 3
0
def main(host=DEFAULT_HOST, port=DEFAULT_PORT):
    run(micropsi_app, host=host, port=port, quiet=True, server='cherrypy')  # devV
Ejemplo n.º 4
0
def main(host=DEFAULT_HOST, port=DEFAULT_PORT):
    run(host=host, port=port, quiet=True)  # devV