The problem of authenticate () function in auth Module in django

this module is used to authenticate users

from django.contrib.auth import authenticate

A few days ago, you can use user = authenticate (username=username, password=password)
to return a user, but today you try to return None

.

the following problems recur

clipboard.png

username, password, email

clipboard.png

clipboard.png

user check_password()

clipboard.png

authenticate()

clipboard.png

clipboard.png

usercheck_password()True

clipboard.png

this question is very perplexing. I would like to ask you for advice.

Mar.04,2021

check to see if django.contrib.auth.middleware.AuthenticationMiddleware is enabled in MIDDLEWARE_CLASSES

another best way to debug is to see the breakpoint step by step to see what the reason is


check whether the is_active of the created user is 1. If not, the password is not valid when using authenticate authentication

Menu