django_components
  1. Install django_components module:
pip install django_components
  1. In settings add following:
STATICFILES_DIRS += os.path.join(BASE_DIR, "components")
  1. In settings remove APP_DIRS from TEMPLATES variable:
	"APP_DIRS": True,
  1. In settings add loaders and builtins in TEMPLATES variable:
TEMPLATES = [
    {
	    ...
        "OPTIONS": {
            "context_processors": [
                ...
            ],
            "loaders": [
                (
                    "django.template.loaders.cached.Loader",
                    [
                        "django.template.loaders.filesystem.Loader",
                        "django.template.loaders.app_directories.Loader",
                        "django_components.template_loader.Loader",
                    ],
                )
            ],
            "builtins": [
                "django_components.templatetags.component_tags",
            ],
        },
    },
]

­čĺíNote that this module is incompatible with django-debug-toolbar because it requires APP_DIRS to function, which is removed for this plugin. so alternatively django.template.loaders.app_directories.Loader can be added to fix the issue:

TEMPLATES = [
    {
        ...
        "OPTIONS": {
	        ...
            "loaders": [
                "django.template.loaders.app_directories.Loader",
                ...
            ],
        },
    },
]