'my_templates' is not a registered tag library.

I am trying to add my custom templates folder but django doesn’t recognize it.

You can see that I added the templates folder in the way as describe in the documentation

This is the my_templates script

from django import template

register = template.Library()


@register.filter
def to_str(value):
    return str(value)

The app has been added to the apps list as well

INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "base.apps.BaseConfig",
]

Really don’t understand why this is not working.

What’s happening when you {% load my_templates %} in your template?

What’s the content of your base.apps file?

What does your template look like where you’re trying to use this?

Side note: I’ve recreated what you’ve posted here, and it works for me.

This is the error message

this is base.apps.py

from django.apps import AppConfig

class BaseConfig(AppConfig):
    default_auto_field = "django.db.models.BigAutoField"
    name = "base"

What does your template look like where you’re trying to use this?

I am not even applying it anywhere in the template, just trying to load it.

Thanks for your help.

What versions of Django and Python are you using?

Are you trying to run your project from that location, or are you just showing a copy from somewhere?

I’m running the project from the projects root location.

Django version 4.1
Python version 3.10

I can’t recreate this issue.

Do you have any other custom tags defined? Are you using any apps that are possibly redefining the load tag?

What is the TEMPLATES setting?

Is what you’ve shown above the complete INSTALLED_APPS setting?

Do you have any other custom tags defined? Are you using any apps that are possibly redefining the load tag?

No

What is the TEMPLATES setting?

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [BASE_DIR / "base/templates/base"],
        "APP_DIRS": True,
        "OPTIONS": {
            "context_processors": [
                "django.template.context_processors.debug",
                "django.template.context_processors.request",
                "django.contrib.auth.context_processors.auth",
                "django.contrib.messages.context_processors.messages",
            ],
        },
    },
]

Is what you’ve shown above the complete INSTALLED_APPS setting?

yes

I don’t know what to say here. I can’t replicate what you’re showing in my test environment.

The only next step that I can think of is for you to create a new virtual environment with a new set of python package installs. Perhaps there’s something corrupted in your current environment.