is says that [20/Feb/2024 22:59:10] “GET /accounts/logout/ HTTP/1.1” 405 0
in drf by link http://127.0.0.1:8000/api/v1/ i click on registered user → logout and it throw an error
also if i try to visit http://127.0.0.1:8000/accounts/logout/ it has the same error
questionTime/urls.py
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.contrib.auth.views import LogoutView
from django.urls import include, path, re_path
from django_registration.backends.one_step.views import RegistrationView
from core.views import IndexTemplateView
from users.forms import CustomUserForm
urlpatterns = [
path('admin/', admin.site.urls),
path(
"accounts/register/", RegistrationView.as_view(form_class=CustomUserForm, success_url="/",),
name="django_registration_register",),
path("accounts/", include("django.contrib.auth.urls")),
path("api-auth/", include("rest_framework.urls")),
path('auth/', include('djoser.urls')),
path('auth/', include('djoser.urls.authtoken')),
path("api/v1/", include("questions.api.urls")),
path("api-auth/logout/", LogoutView.as_view(), name="rest_logout"),
re_path(r"^.*$", IndexTemplateView.as_view(), name="entry-point"),
]
core/views.py
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic.base import TemplateView
class IndexTemplateView(LoginRequiredMixin, TemplateView):
template_name = "index.html"
users/forms.py
from django_registration.forms import RegistrationForm
from users.models import CustomUser
class CustomUserForm(RegistrationForm):
class Meta(RegistrationForm.Meta):
model = CustomUser