This space is available for advertisement. Please contact us if interested.
Advertise with us
django password   0   16845
How to reset Django superuser password

It is quite easy to forget the superuser password of your Django application if the Admin part is not used frequently. We can always create a new superuser but that would not be a good idea from the security perspective.

We can always reset the superuser password of the Django application.

Method 1:

Go to the working directory of your project and run below command.

python changepassword <username>

This will prompt for new password and then will ask the password again.

(pythoncircle) rana@brahma:pythoncircle$ python changepassword superuseradmin
Changing password for user 'superuseradmin'
Password (again):
Password changed successfully for user 'superuseradmin'

If you do not provide any username, it will try to change the password which matches the current system user. For example, my current user of the system is "rana", hence running the password change command without the password it shows below error.

(pythoncircle) rana@brahma:pythoncircle$ python changepassword
CommandError: user 'rana' does not exist

Method 2:

If you are able to login to the admin site using some other super admin credentials, you can change the password from there as well. On the user details page, click on the link with the text "this form" given below password hash details.

superuser password change django

Clicking the link will open another page where you can change the password.

superuser password change django

Method 3:

The password of a user can be reset using the command:

django-admin changepassword <username>

But this command will work only if Django's authentication system is installed. Read about this command in detail here.

Host your Django Application for free on PythonAnyWhere. If you want the full control on your application and server, you should consider DigitalOcean. Create an account with this link and get $100 credits.

django password   0   16845

Related Articles:
Encryption-Decryption in Python Django
How to encrypt and decrypt the content in Django, Encrypting the critical information in Django App, Encrypting username, email and password in Django, Django security...
How to upload an Image file in Django
This article explains the simple steps of uploading and storing an image in Django application, After storing the image, how to use it in Django template or emails, Uploading a file in Django, Storing image in Django model, Uploading and storing the image in Django model, HTML for multipart file upload...
Getting query params from request in Django
In this article, we will see how to access the query parameters from a request in the Django view, Accessing GET attribute of request, get() vs getlist() method of request in Django, query parameters Django,...
Hello Word in Django 2: How to start with Django 2
In this article, we will see how to start working with Django 2.2, Step by step guide to install Django inside a virtual environment and starting the application on localhost, Django 2.2 installation, first Django project, hello world in Django 2.2, First Django application...

0 thoughts on 'How To Reset Django Superuser Password'
Leave a comment:

*All Fields are mandatory. **Email Id will not be published publicly.

DigitalOcean Referral Badge

Get a .COM for just $5.98!

© 2021-2022 Python Circle   Contact   Sponsor   Archive   Sitemap   Partner Sites: PythonSnippets.Dev  99Dev.Tools