当前位置:
首页 >
authenticate总是返回None
发布时间:2023/12/31
47
豆豆
生活随笔
收集整理的这篇文章主要介绍了
authenticate总是返回None
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
自己对参考链接中的代码进行了扩展,完整如下:
Python 3.6.10 |Anaconda, Inc.| (default, Jan 7 2020, 21:14:29)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> eml = "4@a.com"
>>> pw = "pass"
>>> uname = 'w2'
>>> from user.models import User
>>> user = User.objects.create_user(uname,eml,pw)
>>> user.save()
>>> user.check_password(pw)
True
>>> from django.contrib.auth import authenticate
>>> user = authenticate(username=uname, password=pw)
>>> user
<User: w2>
总结
以上是生活随笔为你收集整理的authenticate总是返回None的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: django中的form.is_vali
- 下一篇: 'Request' object has