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()
本站文章如无特殊说明,均为本站原创,如若转载,请注明出处:django重置管理员密码 - Python技术站