Django 1.11.0模板语法错误位于/tableapp/index/';冗长的名称';不是已注册的标记库。必须是以下各项之一:

Django 1.11.0模板语法错误位于/tableapp/index/';冗长的名称';不是已注册的标记库。必须是以下各项之一:,django,templatetags,Django,Templatetags,我正在做django项目。当我使用python 3.5在windows上运行服务器时 这对我来说很好。但是在Linux上,使用Python2.5是不起作用的。 它给出了以下错误: TemplateSyntaxError at /tableapp/index/ 'verbose_names' is not a registered tag library. Must be one of: admin_list admin_modify admin_static admin_urls cache

我正在做django项目。当我使用python 3.5在windows上运行服务器时 这对我来说很好。但是在Linux上,使用Python2.5是不起作用的。 它给出了以下错误:

TemplateSyntaxError at /tableapp/index/

'verbose_names' is not a registered tag library. Must be one of:
admin_list
admin_modify
admin_static
admin_urls
cache
i18n
l10n
log
static
staticfiles
tz
widget_tweaks
verbose_names.py在文件夹tableapp/templatetags中定义/

from django import template
from django.template.defaultfilters import stringfilter

register = template.Library()


@register.simple_tag
def get_verbose_field_name(instance, field_name):
    """
    Returns verbose_name for a field.
    """
    return instance._meta.get_field(field_name).verbose_name.title()


@register.simple_tag
@stringfilter
def trim(value):
    return value.lower().strip()


@register.filter
def get_item(dictionary, key):
    return dictionary.get(key)
模板(configuration.html)在/tableapp/index/处呈现:

{% extends 'base.html' %}
{% load verbose_names %}

{% block extra_css %}

 <style>
 /*Tags not selected class*/
.span1 {
  background-color: #ADD8E6;
  border: none;
  border-radius: 12px;
  color: white;
  padding: 10px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 13px;
  margin: 1px 1px;
}

/*Setting Width for tagsBox*/
.bootstrap-tagsinput {
  /*width: 70% !important;*/
  width: 420px !important;
}

/*Avoid text box*/
.bootstrap-tagsinput {
 border: none;
 box-shadow: none;
}

.bootstrap-tagsinput input {
   display: none;
}

/*Tags Selected Class*/
.myclass {
  background-color: #3090C7;
  border: none;
  border-radius: 12px;
  color: white;
  padding: 10px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 13px;
  margin: 1px 1px;
}
</style>
{% endblock %}
{%extends'base.html%}
{%load verbose_names%}
{%block-extra_-css%}
/*未选择类的标记*/
.span1{
背景色:#添加8e6;
边界:无;
边界半径:12px;
颜色:白色;
填充:10px;
文本对齐:居中;
文字装饰:无;
显示:内联块;
字体大小:13px;
保证金:1px 1px;
}
/*设置标记框的宽度*/
.引导标记输入{
/*宽度:70%!重要*/
宽度:420px!重要;
}
/*避免文本框*/
.引导标记输入{
边界:无;
盒影:无;
}
.引导标记输入{
显示:无;
}
/*标记选定的类*/
.myclass{
背景色:#3090C7;
边界:无;
边界半径:12px;
颜色:白色;
填充:10px;
文本对齐:居中;
文字装饰:无;
显示:内联块;
字体大小:13px;
保证金:1px 1px;
}
{%endblock%}
我在下面的链接上搜索了这个问题,搜索了所有的答案,但没有一个有效,我还不知道这个问题


按照惯例,模板标签应该是 您的_app/templatetags/将包含两个文件,一个是init.py,另一个是您的模板标记文件(假设为my _tag.py) 然后您必须将其加载到模板中
{%load my_tag%}

您使用的是
virtualenvs
?是的,我使用的是virtualenvspasted Wsgi.py文件。如何在这篇文章中提到virtualenv?别担心,不是这样的。我删除了你的编辑。你试过重新启动Django服务器吗?是的,很多次我都是这样重新启动的