Problems with django logout Url [duplicate]
I have a problem with logout, which is when I define the logout path in urls.py:
path ('logout/', auth_views.LogoutView.as_view(template_name='accounts/logout.html'), name='logout')
I get HTTP error 405, which says: this page isn't working right now
but when i change the path to:
path ('logout/', auth_views.LoginView.as_view(template_name='accounts/logout.html'), name='logout')
, it displays logout page, even though, technically, the user is still logged in and the profile is displayed while it should be anonymous!
settings.py
LOGIN_URL = '/account/login/'
LOGOUT_URL = '/account/logout'
urls.py
from django.urls import path
from. import views
from django.contrib.auth import views as auth_views
urlpatterns = [
path ('login/', auth_views.LoginView.as_view(template_name='accounts/login.html'), name='login'),
path('logout/', auth_views.LoginView.as_view(template_name='accounts/logout.html'), name='logout'),