Hi everyone, new to Django.
I’m struggling with this error:
‘messages’ is not a registered tag library.Must be one of: admin_list,admin_modify, admin_urls, cache, i18n, l10n, log, static, tz.
This error occurs when I use {% load messages %}. I already checked my settings.py and everything looks fine. The:
'django.contrib.messages',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
are all placed correctly.
And now, I can’t really fix the problem after troubleshooting it all the possible ways that Internet suggests me to do. I hope someone can help me on this. Thank you so much.
btw. This is my scratch login.html looks like
{% extends "base.html" %}
{% block title %}Log In{% endblock %}
{% block content %}
<h2>Log In</h2>
<form method="post">
{% csrf_token %}
<!-- Username Field -->
<div class="form-group">
<label for="{{ auth_form.username.id_for_label }}">Username</label>
{{ auth_form.username }}
</div>
<!-- Password Field -->
<div class="form-group">
<label for="{{ auth_form.password.id_for_label }}">Password</label>
{{ auth_form.password }}
</div>
{{ auth_form.password.errors }}
{% if auth_form.password.errors %}
<div class="alert alert-primary" role="alert">
A simple primary alert—check it out!
</div>
{% endif %}
<br>
<button type="submit">Log In</button>
</form>
{% endblock %}
And here is my base.html:
{% load static %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}Django{% endblock %}</title>
<link rel="stylesheet" type="text/css" href="{% static 'css/styles.css' %}">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.min.js"></script>
</head>
<body>
<main>
{% block content %}
{% endblock %}
</main>
</body>
</html>