Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23160

django.contrib.auth.views LogoutView not working [duplicate]

$
0
0

I am using latest version of django and I want to create a LogoutView using builtin system. But this is giving error when I try to run the server, and not working LogoutView.

error image

Below is the urls.py code.

from django.contrib import adminfrom django.urls import path, includefrom users import views as user_viewsfrom django.contrib.auth import views as auth_viewsurlpatterns = [    path('admin/', admin.site.urls),    path('food/',include('food.urls')),    path('register/',user_views.register,name='register'),    path('login/',auth_views.LoginView.as_view(template_name='users/login.html'),name='login'),    path('logout/',auth_views.LogoutView.as_view(template_name='users/logout.html'),name='logout'),]

When I checked, I found that the error is :

HTTP error code 405 stands for "Method Not Allowed."  Django's LogoutView, the expected method for logout is typically POST but this is getting in terminal:"GET /logout/ HTTP/1.1" 405 0Method Not Allowed (GET): /logout/Method Not Allowed: /logout/

Viewing all articles
Browse latest Browse all 23160

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>