close

[Solved] AttributeError: module Django.contrib.auth.views has no attribute

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error AttributeError: module Django.contrib.auth.views has no attribute in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How AttributeError: module Django.contrib.auth.views has no attribute Error Occurs?

Today I get the following error AttributeError: module Django.contrib.auth.views has no attribute in python.

How To Solve AttributeError: module Django.contrib.auth.views has no attribute Error ?

  1. How To Solve AttributeError: module Django.contrib.auth.views has no attribute Error ?

    To Solve AttributeError: module Django.contrib.auth.views has no attribute Error
    Open urls.py and replace:
    django.contrib.auth.views.login with django.contrib.auth.views.LoginView

  2. AttributeError: module Django.contrib.auth.views has no attribute

    To Solve AttributeError: module Django.contrib.auth.views has no attribute Error
    Open urls.py and replace:
    django.contrib.auth.views.login with django.contrib.auth.views.LoginView

Solution 1

Open urls.py and replace:

django.contrib.auth.views.login with django.contrib.auth.views.LoginView

django.contrib.auth.views.logout with django.contrib.auth.views.LogoutView

Solution 2

Your urlpatterns should be:

from django.contrib.auth import views as auth_views

urlpatterns = [
   url( r'^login/$',auth_views.LoginView.as_view(template_name="useraccounts/login.html"), name="login"),
]

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read