方法一
代码语言:javascript复制python manage.py shell
from django.contrib.auth.models import User
user=User.objects.get(username='XXX')
user.set_password('new_password')
user.save()
方法二
代码语言:javascript复制D:PyCharm-ProjectdjangoProjectYz_admin>python manage.py changepassword yz
Changing password for user 'yz'
Password:
Password (again):
Password changed successfully for user 'yz'