• Home
  • Our Latest Travel News
Blue Orange Green Pink Purple

Forgot Django admin password? Reset it on the command line.

Posted in Cardiff SEO. on January 28th, 2009 by Cole
Jan 28

Just a quick post. Was just rerouting some of my django stuff so I can hang a test site that I was working on from a new domain and realised that I’d forgotten my admin password doh!

So instead of farting around hashing a replacement and putting it in the database I thought I’d have a go on the python command line, so here it is:



>>> from django.contrib.auth.models import User

# Grab all users and output
>>> userlist = User.objects.all()
>>> userlist
[< User:yourusername >]

# Refer to your required user by index and set new password
>>> userlist[0].set_password('newpasswd')

# Then save it
>>> userlist[0].save()

All done!

Don't forget to:

  • Sign up to RSS - (opens in a new window)
  • Get email updates - (opens in a new window)

Comment on "Forgot Django admin password? Reset it on the command line.".

Cole Whitelaw
I'm Head of Digital Marketing for an international publishing company. Well, I will be until May 22nd when I cast off my shackles and spend the next 7 months traveling the world.
I'll be taking in vistas, co-working spaces and copious local grub so keep 'em peeled here for the latest.

  • Subscribe
    Subscribe via Feed Burner  Subscribe now
  • Categories
    • Affiliate Marketing
    • Cardiff SEO
    • In the workplace
    • Just for fun
    • PPC
    • SEO
    • Social Media
    • Travel
    • Zimbabwe
  • Home
  • Our Latest Travel News

© Copyright Cole Whitelaw. All rights reserved.
Original Wordpress Theme brought to you by Smashing Magazine. Refined by my own fair hand.

Back to Top