How to change user’s password in Django without using admin interface

To change user’s password in django you can use Django admin interface. But what if you do not use admin application for any reason?

You should ssh to you server. Navigate to the directory where your file is located. Next, activate your virtualenv (if you’re using one) and go to django shell typing python shell.

Now, you are presented with python interpreter. If you have user with username ‘testuser’ and want to change it’s password to be ‘testpassword’ you should execute fallowing lines:

Hit ctrl+D to exit python interpreter and type exit to exit your ssh session.

You can also use python changepassword testuser

This will prompt you to enter new password twice.

Both methods are exactly the same but first one is using shell witch allows you to do more powerful stuff but you can easily make some problems too.


Leave a Reply

Your email address will not be published. Required fields are marked *