python manage.py shell
指定要修改的帳號,set_password中填入新密碼 # import User first
from django.contrib.auth.models import User
# reset password
user = User.objects.get(username='root') user.set_password('newpassword')
user.save()
如果忘記帳號的查詢方式 # list superuser
User.objects.filter(is_superuser=True)
# list all user
User.objects.all()
找到帳號後再用剛剛的方式重設密碼即可