Hello Coders!

In this Blog, we will learn how to change the password of the superuser on a Django project.

Django stores passwords in a complex, crypted way, and because of this, we cannot directly manipulate the password of the user. However, there are several ways to change the superuser’s password.

How to create superuser in Django?

For creating superuser, first reach the same directory as that of manage.py and run the following command:

python manage.py createsuperuser

Then enter the Username of your choice and press enter.

Username: sai

Then enter the Email address and press enter.(It can be left blank)

Email address: [email protected]

Next, enter the Password in-front of the Password field and press enter.Enter a strong password so as to keep it secure.

Password: ******  

Then again enter the same Password for confirmation.

Password(again): ******

Superuser created successfully if above fields are entered correctly.

Django stores passwords in a complex, crypted way, and because of this, we cannot directly manipulate the password of the user. However, there are several ways to change the superuser’s password.

How to change password of superuser in Django?

For changing password of superuser, first reach the same directory as that of manage.py and run the following command:

python manage.py changepassword user_name

Changing password for user ‘user_name’

Enter the Password in-front of the Password field and press enter. Enter a strong password so as to keep it secure.

password : ******
Password (again): ******

This password is too short. It must contain at least 8 characters.

Enter the Password again in-front of the Password field and press enter. Enter a strong password and at least of 8 characters so as to keep it secure.

Password: ********
Password (again): ********

Now we can login into our Django Admin page by running the command python manage.py runserver . Then, open a Web browser and go to “/admin/” on your local domain – e.g., http://127.0.0.1:8000/admin/ and then enter the same Username and Password.

refer my previous blog to Create a project and then use this as reference to create and change superuser and password

https://studygyaan.com/django/how-to-migrate-file-in-django

ThankYou