in the docs https://docs.djangoproject.com/en/3.1/howto/custom-template-tags/ there is a guide on how to register tags for a specific app, however I am wondering is there a way to register tags globally (i.e. for all apps to access)?
What you’re asking for is not very commonly done in Django projects because template tags are conventionally imported from apps via load
.
If it’s important to you to load something globally, however, then you could possibly use a custom context processor, but those are typically meant for adding more data.
A more involved option would be to use a custom instance of the DjangoTemplates
engine type. The engine has a builtins
keyword argument where you could probably load in your own template tags. In my many years of working with Django, I’ve never done this so I would suggest you tread lightly if you choose to follow this particular path. The docs about engine configuration are at https://docs.djangoproject.com/en/3.1/ref/templates/api/#configuring-an-engine.