【问题标题】:Django cannot find custom template tagsDjango 找不到自定义模板标签
【发布时间】:2012-06-24 21:30:21
【问题描述】:

我在我的应用程序中创建了一个 templatetags 文件夹,里面有一个 __init__.py + active.py,即使应用程序在 INSTALLED_APPS 中,Django 也找不到它:

''active'' is not a valid tag library: Template library 'active' not found, tried
django.templatetags.'active',website.home.templatetags.'active',
django_extensions.templatetags.'active',django.contrib.flatpages.templatetags.'active',
django.contrib.staticfiles.templatetags.'active',
django.contrib.admin.templatetags.'active'

【问题讨论】:

    标签: python django django-templates


    【解决方案1】:

    你可能尝试过这样load you template tags

    {% load 'active_tags' %}
    

    试试这个:

    {% load active_tags %}
    

    【讨论】:

      猜你喜欢
      • 2011-12-31
      • 2021-07-13
      • 2011-02-19
      • 2015-01-20
      • 2012-03-15
      • 2017-07-29
      • 1970-01-01
      • 2015-12-17
      相关资源
      最近更新 更多