def start_site(config, resource): log.info('Starting the API on port %s' % config.port) if config.manhole: log.info('Starting the manhole on port 8008') multiService = manhole_tap.makeService( dict(namespace=globals(), telnetPort='8008', sshPort='8009', sshKeyDir='sshKeyDir', sshKeyName='id_rsa', sshKeySize=4096, passwd='passwd')) telnetService, sshService = multiService.services telnetFactory = telnetService.factory sshFactory = sshService.factory reactor.listenTCP(8008, telnetFactory, interface='localhost') reactor.listenTCP(8009, sshFactory, interface='localhost') site = PixelatedSite(resource) site.displayTracebacks = False if config.sslkey and config.sslcert: reactor.listenSSL(config.port, site, _ssl_options(config.sslkey, config.sslcert), interface=config.host) else: reactor.listenTCP(config.port, site, interface=config.host)