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
if you forget your admin then you need to create new user by using
python manage.py createsuperuser <username>
and for password there is CLI command changepassword
for django to change user password
python manage.py changepassword <username>
OR
django-admin changepassword <username>
OR Run this code in Django env
from django.contrib.auth.models import User
u = User.objects.get(username='john')
u.set_password('new password')
u.save()
python manage.py createsuperuser
will create another superuser, you will be able to log into admin and rememder your username.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()
This is very good question.
python manage.py changepassword user_name
Example :-
python manage.py changepassword mickey