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
One of the best ways to retrieve the username and password is to view and update them. The User Model provides a perfect way to do so.
Navigate to your root directory i,e. where you "manage.py" file is located using your console or other application such as Git.
Retrieve the Python shell using the command "python manage.py shell".
Import the User Model by typing the following command "from django.contrib.auth.models import User"
Get all the users by typing the following command "users = User.objects.all()"
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.
"user = users[0]"
Set the password
user.set_password('name_of_the_new_password_for_user_selected')
Save the new password
"user.save()"
Start the server and log in using the username and the updated password.