Django forgot the administrator or forgot the administrator password to reset the login password
- 2020-10-23 21:02:24
- OfStack
The headline tells you that you forgot your password... Yes, it was me.
You forgot your password, too? Don't worry!
0 x00:
Step 1: Run django shell
python3 manage.py shell
0 x01:
Step 2: Reset the password
>>> from django.contrib.auth.models import User
>>> user = User.object.get(username='your_account')
>>> user.set_password('your_new_password')
>>> user.save()
>>> quit()
0 x02:
If you can't remember the administrator's username...
Don't panic if it's nothing.
>>> 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()
There are ways...