'bootstrap_tags' is not a valid tag library

Nima picture Nima · Apr 20, 2014 · Viewed 10.1k times · Source

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 %}

Answer

Zhen Xie picture Zhen Xie · Apr 22, 2014

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.