Django problem error_TypeError_ as_view() takes 1 positional argument but 2 were given

I. Wrong position

from django.urls import path

from users_app.views import RegisterView, LoginView, LogoutView

app_name = 'users'
urlpatterns = [
    path("register/", RegisterView.as_view, name="register"),
    path("login/", LoginView.as_view, name="login"),
    path("logout/", LogoutView.as_view, name="logout"),
]

III. Solutions

  • () required after as \ _ view as a method
 path("register/", RegisterView.as_view(), name="register"),
    path("login/", LoginView.as_view(), name="login"),
    path("logout/", LogoutView.as_view(), name="logout"),