class Core(Application): """ The very core of Apollo. Everything depends on this. """ def __init__(self): logging.getLogger().setLevel(options.logging_level) if options.debug: logging.warn("==================================================================================") logging.warn("SERVER IS RUNNING IN DEBUG MODE! MAKE SURE THIS IS OFF WHEN RUNNING IN PRODUCTION!") logging.warn("==================================================================================") logging.info("Starting server...") # apollo distribution root dist_root = os.path.join(os.path.dirname(__file__), "..", "..") Application.__init__( self, [ (r"/", FrontendHandler), (r"/session", SessionHandler), (r"/action", ActionHandler), (r"/events", EventsHandler), (r"/dylib/(.*)\.js", DylibHandler) ], dist_root = dist_root, static_path = os.path.join(dist_root, "static"), debug = options.debug ) self.loader = Loader(os.path.join(dist_root, "template")) setupDBSession() self.dylib_dispatcher = DylibDispatcher(self) self.bus = Bus(self) self.plugins = PluginRegistry(self) self.cron = CronScheduler(self) def go(self): """ Start the server proper. """ self.bus.go() self.plugins.loadPluginsFromOptions() self.cron.go() logging.info("Server ready (may be still waiting for message bus).") self.rendervisor = RendererSupervisor() self.rendervisor.go()
def __init__(self): logging.getLogger().setLevel(options.logging_level) if options.debug: logging.warn("==================================================================================") logging.warn("SERVER IS RUNNING IN DEBUG MODE! MAKE SURE THIS IS OFF WHEN RUNNING IN PRODUCTION!") logging.warn("==================================================================================") logging.info("Starting server...") # apollo distribution root dist_root = os.path.join(os.path.dirname(__file__), "..", "..") Application.__init__( self, [ (r"/", FrontendHandler), (r"/session", SessionHandler), (r"/action", ActionHandler), (r"/events", EventsHandler), (r"/dylib/(.*)\.js", DylibHandler) ], dist_root = dist_root, static_path = os.path.join(dist_root, "static"), debug = options.debug ) self.loader = Loader(os.path.join(dist_root, "template")) setupDBSession() self.dylib_dispatcher = DylibDispatcher(self) self.bus = Bus(self) self.plugins = PluginRegistry(self) self.cron = CronScheduler(self)