def load_routes(self):
        """
        Load all routes in project's folder 'controllers'.

        Ignore files with leading underscore (for example: controllers/_blog.py)
        """
        for file_name in os.listdir(os.path.join(self._project_dir, 'controllers')):
            # ignore disabled controllers
            if not file_name.startswith('_'):
                module_name = file_name.split('.', 1)[0]
                module_path = "controllers.{}".format(module_name)
                module = import_module(module_path)
                controllers = [getattr(module, x) for x in dir(module) if x != 'Controller' and x.endswith('Controller')]
                controller = controllers[0]
                self._routes[module_name] = controller
        return self._routes
def load_routes ( self ) : for file_name in os . listdir ( os . path . join ( self . _project_dir , 'controllers' ) ) : if not file_name . startswith ( '_' ) : module_name = file_name . split ( '.' , 1 ) [ 0 ] module_path = "controllers.{}" . format ( module_name ) module = import_module ( module_path ) controllers = [ getattr ( module , x ) for x in dir ( module ) if x != 'Controller' and x . endswith ( 'Controller' ) ] controller = controllers [ 0 ] self . _routes [ module_name ] = controller return self . _routes
Load all routes in project's folder 'controllers'.

        Ignore files with leading underscore (for example: controllers/_blog.py)