'bootstrap_tags'不是有效的标签库 [英] 'bootstrap_tags' is not a valid tag library
本文介绍了'bootstrap_tags'不是有效的标签库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我想使用pinax模板时,我会收到以下错误:
p> 'bootstrap_tags'不是有效的标签库:没有找到模板库bootstrap_tags,尝试django.templatetags.bootstrap_tags,django.contrib.admin .templatetags.bootstrap_tags,django.contrib.staticfiles.templatetags.bootstrap_tags,account.templatetags.bootstrap_tags
这里是signup.html的pinax主题:
{%extendssite_base.html%}
{%从未来%加载url}
{%load i18n%}
{%load bootstrap_tags%}
{%block head_title%} {%trans注册%} {% endblock%}
{%block body%}
< div class =row>
< div class =span8>
< form id =signup_form
method =post
action ={%urlaccount_signup%}
autocapitalize =off
class =form-horizontal{%if form.is_multipart%} enctype =multipart / form-data{%endif%}>
< legend> {%trans注册%}< / legend>
< fieldset>
{%csrf_token%}
{{form | as_bootstrap}}
{%如果redirect_field_value%}
< input type =hiddenname ={{redirect_field_name}} value ={{redirect_field_value}}/>
{%endif%}
< div class =form-actions>
< button type =submitclass =btn btn-primary> {%trans注册%}< / button>
< / div>
< / fieldset>
< / form>
< / div>
< div class =span4>
{%includeaccount / _signup_sidebar.html%}
< / div>
< / div> {%endblock%}
解决方案
此错误是由于 django_forms_bootstrap
Python包未安装;因此,django.forms.bootstrap导入失败。
pip install django_forms_bootstrap
然后在settings.py
中将'django_forms_bootstrap'
添加到INSTALLED_APPS,然后重新启动您的网站或runserver。
I'm using pinax-theme-bootstrap-account with django-user-accounts.
When I want to use pinax templates I get this error:
'bootstrap_tags' is not a valid tag library: Template library bootstrap_tags not found,tried django.templatetags.bootstrap_tags,django.contrib.admin.templatetags.bootstrap_tags,django.contrib.staticfiles.templatetags.bootstrap_tags,account.templatetags.bootstrap_tags
Here is pinax-theme for signup.html:
{% extends "site_base.html" %}
{% load url from future %}
{% load i18n %}
{% load bootstrap_tags %}
{% block head_title %}{% trans "Sign up" %}{% endblock %}
{% block body %}
<div class="row">
<div class="span8">
<form id="signup_form"
method="post"
action="{% url "account_signup" %}"
autocapitalize="off"
class="form-horizontal"{% if form.is_multipart %} enctype="multipart/form-data"{% endif %}>
<legend>{% trans "Sign up" %}</legend>
<fieldset>
{% csrf_token %}
{{ form|as_bootstrap }}
{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
{% endif %}
<div class="form-actions">
<button type="submit" class="btn btn-primary">{% trans "Sign up" %}</button>
</div>
</fieldset>
</form>
</div>
<div class="span4">
{% include "account/_signup_sidebar.html" %}
</div>
</div> {% endblock %}
解决方案
This error is due to the django_forms_bootstrap
Python package not being installed; therefore, the django.forms.bootstrap import is failing.
pip install django_forms_bootstrap
Then add 'django_forms_bootstrap'
to INSTALLED_APPS in settings.py
and then restart your website or runserver.
这篇关于'bootstrap_tags'不是有效的标签库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文