def __init__(self, settings, routes, port): """Create a new Application instance with the specified Routes and settings. :param dict settings: Application settings :param list routes: A list of route tuples :param int port: The port number for the HTTP server """ self.attributes = Attributes() self.host = utils.gethostname() self.port = port self._config = settings or dict() self._insert_base_path() self._prepare_paths() self._prepare_static_path() self._prepare_template_path() self._prepare_transforms() self._prepare_translations() self._prepare_uimodules() self._prepare_version() self.prepare_routes(routes) if not routes: LOGGER.critical('Did not add any routes, will exit') raise exceptions.NoRoutesException() # Get the routes and initialize the tornado.web.Application instance super(Application, self).__init__(routes, **self._config)
def __init__(self, routes=None, port=None, **settings): """Create a new Application instance with the specified Routes and settings. :param list routes: A list of route tuples :param int port: The port number for the HTTP server :param dict settings: Application settings """ self.attributes = Attributes() self.host = utils.gethostname() self.port = port self._config = settings or dict() self._insert_base_path() self._prepare_paths() self._prepare_static_path() self._prepare_template_path() self._prepare_transforms() self._prepare_translations() self._prepare_uimodules() self._prepare_version() # Prepend the system path if needed #if config.BASE in self.paths: # LOGGER.debug('Base Path: %s', self.paths[config.BASE]) # sys.path.insert(0, self.paths[config.BASE]) # Get the routes and initialize the tornado.web.Application instance prepared_routes = self.prepare_routes(routes) LOGGER.debug('Routes: %r', routes) super(Application, self).__init__(prepared_routes, **self._config)
def __init__(self, settings, routes, port): """Create a new Application instance with the specified Routes and settings. :param dict settings: Application settings :param list routes: A list of route tuples :param int port: The port number for the HTTP server """ self.attributes = Attributes() self.host = utils.gethostname() self.port = port self._config = settings or dict() self._insert_base_path() self._prepare_paths() self._prepare_routes(routes) self._prepare_static_path() self._prepare_template_path() self._prepare_transforms() self._prepare_translations() self._prepare_uimodules() self._prepare_version() if not routes: LOGGER.critical('Did not add any routes, will exit') raise exceptions.NoRoutesException() # Get the routes and initialize the tornado.web.Application instance super(Application, self).__init__(routes, **self._config)