Modified files
djangocourse/settings.py
---
+++
@@ -135,7 +135,7 @@
LOGIN_REDIRECT_URL = "home"
-LOGOUT_REDIRECT_URL = "login"
+LOGOUT_REDIRECT_URL = "account_login"
# Internationalization
# https://docs.djangoproject.com/en/5.1/topics/i18n/
djangocourse/urls.py
---
+++
@@ -16,10 +16,12 @@
"""
from django.contrib import admin
from django.urls import path, include
+from django.views.generic.base import RedirectView
urlpatterns = [
path("admin/", admin.site.urls),
path("articles/", include("app.urls")),
- path("accounts/", include("django.contrib.auth.urls")),
+ path("accounts/", include("allauth.urls")),
+ path("", RedirectView.as_view(pattern_name="home")),
path("__debug__/", include("debug_toolbar.urls"))
]
templates/app/base.html
---
+++
@@ -11,12 +11,12 @@
<li><a href="{% url 'home' %}">Articles</a></li>
<li>
{% if user.is_authenticated %}
- <form method="POST" action="{% url 'logout' %}">
+ <form method="POST" action="{% url 'account_logout' %}">
{% csrf_token %}
<button type="submit">Log out</button>
</form>
{% else %}
- <a href="{% url 'login' %}">Log in</a>
+ <a href="{% url 'account_login' %}">Log in</a>
{% endif %}
</li>
</ul>