Django: 'current_tags' is not a valid tag library


I have a small Django project I received from a friend. The code works perfectly on his system. However, on my system I get the following error message when running the server:

TemplateSyntaxError at /

'current_tags' is not a valid tag library: Template library current_tags not found, tried django.templatetags.current_tags

The problem is with a line in an html file:

{% load current_tags %}

This exact same code works on his system with no errors. What could that be?

3/30/2011 11:45:28 PM

Accepted Answer

I would suggest the following:

  1. (Most likely) You haven't installed one of the dependencies of your tag library. Check the imports inside the module.

  2. Make sure the application that includes the tag library is registered in under INSTALLED_APPS.

  3. Make sure that you can successfully import the tag library.

    python shell
    >>> from app.templatetags import current_tags

    This boils down what the following link recommends, which is that the error itself tends to mislead you about where it's looking for a template from. It silently ignores errors on import, which means itself might have a syntax error or another reason why it raises ImportError.

If everything else fails, check this link:

3/26/2016 9:19:17 PM

I had this problem and fixed it by adding a blank file in my appname/templatetags/ directory.

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow