[PYTHON] When you forget your admin screen username / password in Django

When I opened Django for the first time in a while, I forgot my superuser username and password, so This is a memorandum of how to check by hitting the command.

Launch a python command.

python


>>>from django.contrib.auth.models import User
>>>users = User.objects.all()
>>>user = users[0]
>>>user
<User:Forgotten username>
>>>user.set_password('Please set your favorite password')
>>>user.save()

Now that you can set a new password, You can now log in from the management screen.

Recommended Posts

When you forget your admin screen username / password in Django
When you can't call base.html in Django
If you change your password in Django, you'll be logged out without permission
CSRF validation error when accessing django 3.0 admin page in Chrome
Tuning your Django admin site
When you are persistently asked for your Login password with fabric
Django admin screen reverse lookup memo
Register your Django application in your project
Django admin screen customization first step
[Django] Want to customize your admin page?
Django admin screen customization first step
Django admin screen reverse lookup memo
Django2 screen addition flow
Tuning your Django admin site
When you forget your admin screen username / password in Django
The story of failing to update "calendar.day_abbr" on the admin screen of django
Django desired shift batch input screen
How to make only one data register on the Django admin screen
[Python] What to check when you get a Unicode Decode Error in Django