django password   0   18291
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 manage.py changepassword <username>

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

(pythoncircle) rana@brahma:pythoncircle$ python manage.py changepassword superuseradmin
Changing password for user 'superuseradmin'
Password:
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 manage.py 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   18291
0 comments on 'How To Reset Django Superuser Password'
Login to comment


Related Articles:
Creating a bar chart in Django Application
Minimal example of how to create a bar chart or pie chart in Django application using Charts.js. Drawing Analytics charts in Django application. Using charts and graphs to make your Django application visually appealing. Creating Dashboards using Charts.js in Django to convey the information more visually....
Django application to automate the WhatsApp messaging
Django application with REST API endpoints to automate the WhatsApp messaging. Automating WhatsApp web using selenium to send messages. Using selenium to automate whatsapp messaging. Sending bulk messages via whatsapp using automation. Source code Django application Whatsapp Automation...
Python Snippets - A mini project  built using Django - Github Repository made public
mini project, python snippet sharing website, Django project free, Final year project free, Python Django project free,...
Django vs Node.js: Which One Is Better for Web Development?
Benefits of using Django and Node.js, Django vs Node.js: Which One Is Better for Web Development?, Basic features of Django and Node.js, Drawbacks of using Django and Node.js...
DigitalOcean Referral Badge

© 2022-2023 Python Circle   Contact   Sponsor   Archive   Sitemap