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?
manage.py changepassword <user_name>
请参阅文档
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()
You may try through console:
python manage.py shell
then use following script in shell
from django.contrib.auth.models import User
User.objects.filter(is_superuser=True)
will list you all super users on the system. if you recognize yur username from the list:
usr = User.objects.get(username='your username')
usr.set_password('raw password')
usr.save()
and you set a new password (:
链接地址: http://www.djcxy.com/p/62012.html上一篇: 如何在django中链接我的css,js和图像文件链接
下一篇: 如何重置Django管理员密码?