kolibri/utils/cli.py
def start(port=None, daemon=True):
    """
    Start the server on given port.

    :param: port: Port number (default: 8080)
    :param: daemon: Fork to background process (default: True)
    """
    run_cherrypy = conf.OPTIONS["Server"]["CHERRYPY_START"]

    # In case some tests run start() function only
    if not isinstance(port, int):
        port = _get_port(port)

    if not daemon:
        logger.info("Running 'kolibri start' in foreground...")

    else:
        logger.info("Running 'kolibri start' as daemon (system service)")

    if run_cherrypy:
        __, urls = server.get_urls(listen_port=port)
        if not urls:
            logger.error(
                "Could not detect an IP address that Kolibri binds to, but try "
                "opening up the following addresses:\n"
            )
            urls = [
                "http://{}:{}".format(ip, port) for ip in ("localhost", "127.0.0.1")
            ]
        else:
            logger.info("Kolibri running on:\n")
        for addr in urls:
            sys.stderr.write("\t{}\n".format(addr))
        sys.stderr.write("\n")
    else:
        logger.info("Starting Kolibri background services")

    # Daemonize at this point, no more user output is needed
    if daemon:

        kwargs = {}
        # Truncate the file
        if os.path.isfile(server.DAEMON_LOG):
            open(server.DAEMON_LOG, "w").truncate()
        logger.info("Going to daemon mode, logging to {0}".format(server.DAEMON_LOG))
        kwargs["out_log"] = server.DAEMON_LOG
        kwargs["err_log"] = server.DAEMON_LOG

        become_daemon(**kwargs)

    server.start(port=port, run_cherrypy=run_cherrypy)

    Start the server on given port.

    :param: port: Port number (default: 8080)
    :param: daemon: Fork to background process (default: True)
    
Start the server on given port.
Start the server on given port .
def start(port=None, daemon=True):
    run_cherrypy = conf.OPTIONS["Server"]["CHERRYPY_START"]
    if not isinstance(port, int):
        port = _get_port(port)
    if not daemon:
        logger.info("Running 'kolibri start' in foreground...")
    else:
        logger.info("Running 'kolibri start' as daemon (system service)")
    if run_cherrypy:
        __, urls = server.get_urls(listen_port=port)
        if not urls:
            logger.error(
                "Could not detect an IP address that Kolibri binds to, but try "
                "opening up the following addresses:\n"
            )
            urls = [
                "http://{}:{}".format(ip, port) for ip in ("localhost", "127.0.0.1")
            ]
        else:
            logger.info("Kolibri running on:\n")
        for addr in urls:
            sys.stderr.write("\t{}\n".format(addr))
        sys.stderr.write("\n")
    else:
        logger.info("Starting Kolibri background services")
    if daemon:
        kwargs = {}
        if os.path.isfile(server.DAEMON_LOG):
            open(server.DAEMON_LOG, "w").truncate()
        logger.info("Going to daemon mode, logging to {0}".format(server.DAEMON_LOG))
        kwargs["out_log"] = server.DAEMON_LOG
        kwargs["err_log"] = server.DAEMON_LOG
        become_daemon(**kwargs)
    server.start(port=port, run_cherrypy=run_cherrypy)
def start ( port = None , daemon = True ) : run_cherrypy = conf . OPTIONS [ "Server" ] [ "CHERRYPY_START" ] if not isinstance ( port , int ) : port = _get_port ( port ) if not daemon : logger . info ( "Running 'kolibri start' in foreground..." ) else : logger . info ( "Running 'kolibri start' as daemon (system service)" ) if run_cherrypy : __ , urls = server . get_urls ( listen_port = port ) if not urls : logger . error ( "Could not detect an IP address that Kolibri binds to, but try " "opening up the following addresses:\n" ) urls = [ "http://{}:{}" . format ( ip , port ) for ip in ( "localhost" , "127.0.0.1" ) ] else : logger . info ( "Kolibri running on:\n" ) for addr in urls : sys . stderr . write ( "\t{}\n" . format ( addr ) ) sys . stderr . write ( "\n" ) else : logger . info ( "Starting Kolibri background services" ) if daemon : kwargs = { } if os . path . isfile ( server . DAEMON_LOG ) : open ( server . DAEMON_LOG , "w" ) . truncate ( ) logger . info ( "Going to daemon mode, logging to {0}" . format ( server . DAEMON_LOG ) ) kwargs [ "out_log" ] = server . DAEMON_LOG kwargs [ "err_log" ] = server . DAEMON_LOG become_daemon ( ** kwargs ) server . start ( port = port , run_cherrypy = run_cherrypy )
Start the server on given port.
Start the server on given port .
"""
    Start the server on given port.

    :param: port: Port number (default: 8080)
    :param: daemon: Fork to background process (default: True)
    """ # In case some tests run start() function only # Daemonize at this point, no more user output is needed # Truncate the file
port
daemon