def makeService(config): if config['logging']: logging.config.fileConfig(config['logging']) else: logging.basicConfig(level=config.loglevel) obs = PythonLoggingObserver() obs.start() config = loader.load_config(config['config']) loader.setup_environment(config) return runner.getService(config, reactor)
res.putChild("id", ByID(service)) res.putChild("merge", Merge(service)) #realm = TildeRESTRealm() #realm.root = res #portal = Portal(realm, checkers) #credFactory = DigestCredentialFactory("md5", "localhost:8081") #res = HTTPAuthSessionWrapper(portal, [credFactory]) return res if __name__ == '__main__': import logging logging.basicConfig(level=1) from twisted.python import log obs = log.PythonLoggingObserver() obs.start() from tilde.loader import load_config, setup_environment from tilde.runner import getService from twisted.internet import reactor cfg = load_config("etc/tilde.ini") setup_environment(cfg) service, _clean = getService(cfg, reactor) root = getResource(cfg["rest"], service) reactor.listenTCP(8081, server.Site(root)) reactor.run()