'Starts the server.
Static content (e.g., "g/img.jpg") is served from the App.static subfolder (e.g., "static/g").
With threads=10, the server can handle up to 10 concurrent requests.
With queue=10, the server will queue up to 10 waiting requests.
With sessions=True, stores session id in cookie.
With embedded=True, runs under Apache mod_wsgi.
With xhr="*", the server will respond to cross-origin XMLHttpRequests.
With ssl=(key, certificate), runs under https:// (see certificate() function).
With debug=False, starts a production server.'

def run(self, host=LOCALHOST, port=8080, threads=30, queue=20, timeout=10, sessions=False, embedded=False, xhr='*', ssl=None, debug=True):

    if self._up:
        return
    self._host = str(host)
    self._port = int(port)
    self._up = True
    self._xhr = xhr
    if (debug is False):
        cp.config.update({'environment': 'production'})
    if (embedded is True):
        cp.config.update({'environment': 'embedded'})
    else:
        cp.config.update({'server.socket_host': self._host, 'server.socket_port': self._port, 'server.socket_timeout': max(1, timeout), 'server.socket_queue_size': max(1, queue), 'server.thread_pool': max(1, threads), 'server.thread_pool_max': (-1)})
    if ssl:
        cp.config.update({'server.ssl_module': 'builtin', 'server.ssl_private_key': (ssl[0] if os.path.exists(ssl[0]) else openable(ssl[0])), 'server.ssl_certificate': (ssl[1] if os.path.exists(ssl[1]) else openable(ssl[1]))})
    self._app = cp.tree.mount(self, '/', config={'/': {'tools.staticdir.on': (self.static is not None), 'tools.staticdir.dir': self.static, 'tools.sessions.on': bool(sessions), 'tools.sessions.timeout': (60 if (sessions is True) else int(sessions))}})
    self.favicon_ico = cp.tools.staticfile.handler(os.path.join(self.static, 'favicon.ico'))
    os.chdir(self._path)
    if embedded:
        sys.stdout = sys.stderr
    else:
        atexit.register(self.stop)
        cp.engine.start()
        cp.engine.block()
