Sunday, September 5, 2010

Resetting Your Forgotten Django Admin Password: The Easiest Way Yet!

Well, often, developers break their normal habit of setting easy admin passwords such as "teknia - teknia" and set up a complex password and perhaps use the browser to remember the passwords.

After a while, you find that you cannot even remember your password.

Normally, to reset in django, we use the shell utility where we import the User models and use set_password() to reset the password.

Well, there is an easier way.
  1. use the django createsuperuser utility to create a new superuser account
  2. log in the Admin panel with the newly created account
  3. go to the Users models http://localhost:8000/admin/auth/user/ and select the previous user
  4. in the users' account details, use the "change password form" to create anew password for them
  5. you can now log out and log in with the new password. You can keep or delete the second superuser account