Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reset Django admin password?

I am using Django (version 1.3) and have forgotten both admin username and password. How to reset both?

And is it possible to make a normal user into admin, and then remove admin status?

like image 268
IamH1kc Avatar asked Jun 15 '11 13:06

IamH1kc


People also ask

Where is Django admin password?

Retrieve the Python shell using the command "python manage.py shell". Print a list of the users For Python 2 users use the command "print users" For Python 3 users use the command "print(users)" The first user is usually the admin. Select the user you wish to change their password e.g.

What is default Django admin password?

Run 'python manage.py migrate' to apply them. Username (leave blank to use 'chatru'): admin Email address: [email protected] Password: Password (again): The password is too similar to the username.


Video Answer


2 Answers

python manage.py changepassword <user_name> 

see docs

like image 87
JamesO Avatar answered Oct 13 '22 23:10

JamesO


  1. python manage.py createsuperuser will create another superuser, you will be able to log into admin and rememder your username.
  2. Yes, why not.

To give a normal user privileges, open a shell with python manage.py shell and try:

from django.contrib.auth.models import User user = User.objects.get(username='normaluser') user.is_superuser = True user.save() 
like image 30
DrTyrsa Avatar answered Oct 13 '22 22:10

DrTyrsa