This site runs best with JavaScript enabled.

How to Reset a Django Admin Password

Photo by Mr TT on Unsplash

The most efficient way to change your admin password on a Django site.

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.

1python shell
1from django.contrib.auth.models import User

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

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

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

1u = User.objects.get(username='dustin')

Discuss on TwitterEdit post on GitHub

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.

Join the Newsletter

Dustin Davis