Django-账户用户忘记密码
作者:互联网
- 方法1:Terminal命令
- python manage.py changepassword admin
Password: PY666666
Password (again): PY666666
- 方法2:shell命令方式对密码进行修改(默认user)
-
from django.contrib.auth.models import User
user = User.objects.get(username='admin')
user.set_password('PY666666')
user.save()
-
- 方法3:shell命令方式对密码进行修改(扩展后的user)
-
from django.contrib.auth.models import User from django.contrib.auth import get_user_model User=get_user_model() user=User.objects.get(username='admin') user.set_password('PY666666') user.save()
-
标签:get,PY666666,Django,密码,User,contrib,import,忘记,user 来源: https://www.cnblogs.com/beichengshiqiao/p/16130194.html