Django: 'current_tags' is not a valid tag library

前端 未结 17 2802
悲&欢浪女
悲&欢浪女 2020-12-23 18:41

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 serv

17条回答
  •  不思量自难忘°
    2020-12-23 19:08

    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 current_tags.py module.

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

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

      python manage.py 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 current_tags.py itself might have a syntax error or another reason why it raises ImportError.

    If everything else fails, check this link: http://www.b-list.org/weblog/2007/dec/04/magic-tags/

提交回复
热议问题