python - django authenticate 返回结果一直是None

# 不论怎么测试 authenticate 返回结果一直是None,查了查原因好像是 django 2.1 版本的问题

( 我用的是 2.1.7)

解决方法:

1. 先导入

from django.contrib.auth.hashers import check_password

2. 按照步骤,数据库查询用户名,判断密码,判断用户是否存在,最后返回结果

猜你喜欢

转载自www.cnblogs.com/chaoqi/p/10588136.html