Django: 'current_tags' is not a valid tag library

前端 未结 17 2816
悲&欢浪女
悲&欢浪女 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:18

    In my case I have created library instance using tag variable instead of register variable

    tag = template.Library()
    

    But it should be

    register = template.Library()
    

    To be a valid tag library, the module must contain a module-level variable named register that is a template.Library instance, in which all the tags and filters are registered

提交回复
热议问题