Django backend not resolv custom template tags.

Hi there. I have encountered such a problem. I started learning django. I have created templatetag dir in my django app as python module and inv_tags.py in this with following contents:
imports…
tag_register = template.Library()
#@tag_register.simple_tag(name=“hostlist”)
def hostList(id=None):
if id:
hosts = Hosts.objects.get(id=id)
else:
hosts = Hosts.objects.all()
return hosts
tag_register.simple_tag(hostList, ‘hostlist’)
But when i heve started debug webserver, i had following errors:
‘inventory_tags’ is not a registered tag library.
The application has been added to the INSTALLED_APPS list in settings.py
I can’t figure out what the problem is. I need help.

second temlatetags in project level i have created later, for test.

I think that should “templatetags” you’re missing the p there.

1 Like