Django notes --- long time, the administrator account password forgotten how to do?

Forget the administrator account and password, do not panic

 

 

 

 

In shell mode, enter:

from django.contrib.auth.models import User # introduced administrator password stored in the database

user = User.objects.filter () # Find the database which users

user 

Output user can see the user name:

 

 

reset Password:

user = User.objects.get (username = 'alvin') # Get the name of the user alvin

user.set_password ( '123456') # Set Password

user.save () # save

This completes the modifications django Forgot your username or password

Guess you like

Origin www.cnblogs.com/ZJackSparrow/p/11963582.html
Recommended