authenticate总是返回None
生活随笔
收集整理的這篇文章主要介紹了
authenticate总是返回None
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
自己對參考鏈接中的代碼進行了擴展,完整如下:
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>
?
總結(jié)
以上是生活随笔為你收集整理的authenticate总是返回None的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: django中的form.is_vali
- 下一篇: python中nltk的下载安装方式