django重置管理员密码

django版本1.11

>>> from django.contrib.auth.models import User
>>> user = User.objects.get(username='your account')
>>> user.set_password('your password')
>>> user.save()
>>> quit()

 

 

如果你连管理员用户名都忘了:

>>> from django.contrib.auth.models import User
>>> user = User.objects.get(pk=1)
>>> user
<User: you_account>
>>> user.set_password('your_new_password')
>>> user.save()
>>> quit()
 
posted @ 2019-07-18 16:28  黑剑石清  阅读(662)  评论(0编辑  收藏  举报