def _load_commands(self): commands = {} command_list = set(self.default_commands[:]) if self.app.conf is not None: command_list.update(self.app.conf.COMMANDS or []) for class_path in command_list: klass = load_class(class_path) commands[klass.get_name()] = klass return commands
def _load_settings(self, settings_path): """ Load a main tornado application. """ if settings_path is None: if "WEBTOOLS_SETTINGS" not in os.environ: return None settings_path = os.environ["WEBTOOLS_SETTINGS"] try: settings_cls = load_class(settings_path) return settings_cls() except ImportError: raise RuntimeError("Cannot import settings: {0}".format(settings_path))
def take_action(self, options): if not options.settings: raise RuntimeError("For start serverm --settings parameter" " is mandatory!") try: settings_cls = load_class(options.settings) except ImportError: raise RuntimeError("Cannot load settings class: {0}".format(options.settings)) from webtools.application import Application app = Application(settings_cls()) app.listen(8888) # TODO: parametrize this import tornado.ioloop print("Listeing on :{0}".format(8888)) tornado.ioloop.IOLoop.instance().start()
def _load_settings(self, settings_path): """ Load a main tornado application. """ if settings_path is None: if "WEBTOOLS_SETTINGS" not in os.environ: return None settings_path = os.environ["WEBTOOLS_SETTINGS"] try: settings_cls = load_class(settings_path) return settings_cls() except ImportError: raise RuntimeError( "Cannot import settings: {0}".format(settings_path))