Change a user's password from the command line, use the changepassword
command. It will prompt you to change the password for the specified user.
./manage.py changepassword admin
django-admin.py changepassword admin
You can also change a password programmatically:
from django.contrib.auth.models import User
admin = User.objects.get(username='admin')
admin.set_password('mynewpassword')
admin.save()
Comments
Leave a Reply