关于Django的验证用户名密码登录

来源:互联网 发布:高仿阿迪耐克衣服淘宝 编辑:程序博客网 时间:2024/06/05 09:18

由于老师没有讲清楚,或者是我自己没有用心听的缘故,用简单的get方式进行密码登录验证一直不成功,一直到到不了我想要的效果,这个问题困扰我多时,我甚至一直看到Django 的加密方式是如何产生的虽然没有完全看懂,但是也有了许多长进,接下来介绍一下这个用户验证登陆的方式
def templogin(request):        if request.POST:           print ("username:",request.POST['username'])           print ("password:",request.POST['password'])           user=authenticate(username=request.POST['username'],password=request.POST['password'])           print ("user",user)        return render_to_response('login.html',{'user':"user"})
好的,到这里我研究了一天的问题终于解决了,不知道你是否还有更好的方式


0 0
原创粉丝点击