This site runs best with JavaScript enabled.

How to Reset a Django Admin Password

How to Reset a Django Admin Password How to Reset a Django Admin Password

Photo by Mr TT on Unsplash

This is just a quick post to give a tip on how to recover or reset your Django admin username and/or password.

Use your django shell to query the User model.

python manage.py shell
from django.contrib.auth.models import User

If you can't remember your username, you can view all users in the system.

for u in User.objects.all(): print u.username

Once you know your username, you can simply reset the password:

u = User.objects.get(username='dustin')
u.set_password('secret') u.save()
Share article
Dustin Davis

Dustin Davis is a software engineer, people manager, hacker, and entreprenuer. He loves to develop systems and automation. He lives with his wife and five kids in Utah.