sly_Chandan
sly_Chandan

Reputation: 3515

TemplateSyntaxError at /messages/inbox/ 'account_tags' is not a registered tag library. Must be one of:

I am using pinax_messages and pinax_templates.

I am not able to go to the page : http://127.0.0.1:8000/messages/inbox/

I am getting a strange error and dont understand the problem.

I am getting the error:

TemplateSyntaxError at /messages/inbox/
'account_tags' is not a registered tag library. Must be one of:
admin_list
admin_modify
admin_urls
bootstrap
cache
crispy_forms_field
crispy_forms_filters
crispy_forms_tags
crispy_forms_utils
i18n
l10n
log
pinax_messages_tags
static
tz

I am not able to find any help on google.

{% load i18n %}
{% load account_tags %}


<ul class="account-bar">
    {% if request.user.is_authenticated %}
        <li class="user">
            <i class="fas fa-user"></i>
            {% user_display request.user %}
        </li>
        <li class="settings">
            <a href="{% url 'account_settings' %}">
                <i class="fas fa-cog"></i>
                {% trans "Settings" %}
            </a>
        </li>
        <li class="logout">
            <a id="account_logout" href="{% url 'account_logout' %}">
                <i class="fas fa-power-off"></i>
                {% trans "Log out" %}
            </a>
        </li>
    {% else %}
        <li><a href="{% url 'account_login' %}">{% trans "Log in" %}</a></li>
        {% if ACCOUNT_OPEN_SIGNUP %}
            <li><a href="{% url 'account_signup' %}">{% trans "Sign up" %}</a></li>
        {% endif %}
    {% endif %}
</ul>

<form id="accountLogOutForm" style="display: none;" action="{% url 'account_logout' %}" method="POST">
    {% csrf_token %}
</form>

Upvotes: 1

Views: 361

Answers (2)

NKSM
NKSM

Reputation: 5854

You are trying to load account_tags in your template, like {% load account_tags %} . But this tag library is not registered.

You have to add app of account_tags in INSTALLED_APPS.

Or add it to libraries in your settings.py:

TEMPLATES = [
    {   
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            ...
        ],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                ...
            ],
            'libraries': {
                'account_tags': 'myapp.templatetags.account_tags',
            },
        },
    },
]

Upvotes: 0

Akash NO
Akash NO

Reputation: 316

I think you are using django-user-accounts , so i think you dont have django-user-accounts installed with pip , or you might have forgot register it to the settings file

INSTALLED_APPS = (
    # ...
    "account",
    # ...
)

and also the template context processor

TEMPLATE_CONTEXT_PROCESSORS = [
    ...
    "account.context_processors.account",
    ...
]

and also middleware

MIDDLEWARE_CLASSES = [
    ...
    "account.middleware.LocaleMiddleware",
    "account.middleware.TimezoneMiddleware",
    ...
]

Upvotes: 0

Related Questions