def startYamcat(cls, quick=False, block=False): config = YamcatConfig() minecraft = MinecraftServer(config) cherryListener = CherryListener(cherrypy.engine, minecraft, config) cherryListener.subscribe() from controllers.console import Console from controllers.settings import Settings from controllers.plugins import Plugins from controllers.setup import Setup root = Root(config, minecraft) root.console = Console(config, minecraft) root.backups = Backups(config, minecraft) root.settings = Settings(config) root.plugins = Plugins(config) root.setup = Setup(config) #root.system = System(minecraft, config) #yamcatWeb.Server.quickstart(root, config) devmode = False; if config.config.has_option("Yamcat", "dev-mode")==True: devmode = True cherrypy.config.update( { #'environment': 'production', #'log.error_file': 'site.log', 'server.socket_host':config.get("Yamcat", "ip"), 'server.socket_port':config.getint("Yamcat", "port"), 'engine.autoreload.on': devmode } ) webconfig = { '/': { 'tools.staticdir.root':config.templates_dir, 'tools.staticdir.on': True, 'tools.staticdir.dir': "", "tools.caching.on": False, "tools.sessions.on": True, "tools.sessions.timeout": 60 } } if quick == True: cherrypy.quickstart(root, "/", webconfig) else: cherrypy.tree.mount(root, '/', webconfig) cherrypy.engine.start()
import cherrypy from controllers.calculations import Calculations from controllers.datasets import Datasets from controllers.root import Root from controllers.version import Version root = Root() root.calculations = Calculations() root.datasets = Datasets() root.version = Version() cherrypy.tree.mount(root, '/') if __name__ == '__main__': # pragma: no cover cherrypy.quickstart(root, config='config/prod.conf')