Prepare directories that may contain component files:
Searches for dirs set in STATICFILES_DIRS settings. If none set, defaults to searching for a "components" app. The dirs in STATICFILES_DIRS must be absolute paths.
Paths are accepted only if they resolve to a directory. E.g. /path/to/django_project/my_app/components/.
If STATICFILES_DIRS is not set or empty, then BASE_DIR is required.
Source code in src/django_components/template_loader.py
defget_dirs(self)->List[Path]:""" Prepare directories that may contain component files: Searches for dirs set in `STATICFILES_DIRS` settings. If none set, defaults to searching for a "components" app. The dirs in `STATICFILES_DIRS` must be absolute paths. Paths are accepted only if they resolve to a directory. E.g. `/path/to/django_project/my_app/components/`. If `STATICFILES_DIRS` is not set or empty, then `BASE_DIR` is required. """# Allow to configure from settings which dirs should be checked for componentsifhasattr(settings,"STATICFILES_DIRS")andsettings.STATICFILES_DIRS:component_dirs=settings.STATICFILES_DIRSelse:component_dirs=[settings.BASE_DIR/"components"]logger.debug("Template loader will search for valid template dirs from following options:\n"+"\n".join([f" - {str(d)}"fordincomponent_dirs]))directories:Set[Path]=set()forcomponent_dirincomponent_dirs:# Consider tuples for STATICFILES_DIRS (See #489)# See https://docs.djangoproject.com/en/5.0/ref/settings/#prefixes-optionalifisinstance(component_dir,(tuple,list))andlen(component_dir)==2:component_dir=component_dir[1]try:Path(component_dir)exceptTypeError:logger.warning(f"STATICFILES_DIRS expected str, bytes or os.PathLike object, or tuple/list of length 2. "f"See Django documentation. Got {type(component_dir)} : {component_dir}")continueifnotPath(component_dir).is_absolute():raiseValueError(f"STATICFILES_DIRS must contain absolute paths, got '{component_dir}'")else:directories.add(Path(component_dir).resolve())logger.debug("Template loader matched following template dirs:\n"+"\n".join([f" - {str(d)}"fordindirectories]))returnlist(directories)