Я работаю над проектом django. Когда я запускаю сервер в Windows с использованием Python 3.5, он отлично работает для меня. Но в Linux с использованием python 2.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 %}
Я погуглил ссылку ниже для этой проблемы, следил за всеми ответами, но ни один из них не работал, я еще не знаю, в чем проблема.
virtualenvs
? - person scharette   schedule 10.07.2018