def _layout_discovery(self):
        # if project path is not specified, assume it's under the
        # settings folder
        if 'FLEXI_PROJECT_ROOT' not in self._globals:
            self._globals['FLEXI_PROJECT_ROOT'] = os.path.dirname(
                self._settings_path)
        self._project_path = self._globals['FLEXI_PROJECT_ROOT']
        # if site path is not specified, assume it is the same as
        # project path
        if 'FLEXI_SITE_ROOT' not in self._globals:
            self._globals['FLEXI_SITE_ROOT'] = self._project_path
        self._site_path = self._globals['FLEXI_SITE_ROOT']

        # add paths FLEXI_SYS_PATH to sys.path if they exist
        for folder in self._globals['FLEXI_SYS_PATH']:
            if self._is_project_dir(folder) \
                and self._project_dir(folder) not in sys.path:
                sys.path.insert(0, self._project_dir(folder))
            elif self._is_site_dir(folder) \
                and self._site_dir(folder) not in sys.path:
                sys.path.insert(0, self._site_dir(folder))

        # add media folder if MEDIA_ROOT is not already set or is empty
        if 'MEDIA_ROOT' not in self._globals \
            or not self._globals['MEDIA_ROOT']:
            folder = self._globals['FLEXI_MEDIA_FOLDER']
            if self._is_site_dir(folder):
                self._globals['MEDIA_ROOT'] = self._site_dir(folder)
            elif self._is_project_dir(folder):
                self._globals['MEDIA_ROOT'] = self._project_dir(folder)

        # add static folder if STATIC_ROOT is not already set or is empty
        if 'STATIC_ROOT' not in self._globals \
            or not self._globals['STATIC_ROOT']:
            folder = self._globals['FLEXI_STATIC_FOLDER']
            if self._is_site_dir(folder):
                self._globals['STATIC_ROOT'] = self._site_dir(folder)
            elif self._is_project_dir(folder):
                self._globals['STATIC_ROOT'] = self._project_dir(folder)

        # add templates folder if not in TEMPLATE_DIRS
        for folder in self._globals['FLEXI_TEMPLATE_FOLDERS']:
            if self._is_project_dir(folder) \
                not in self._globals['TEMPLATE_DIRS']:
                self._globals['TEMPLATE_DIRS'] += (
                    self._project_dir(folder),
                )
perform layout detection:
dataset/ETHPy150Open hrbonz/django-flexisettings/flexisettings/settings.py/FlexiSettingsProxy._layout_discovery