简体   繁体   中英

Unable to login as superuser in Django admin (Django Girls Tutorial)

I have created a app in python 3.5 and django 1.8.5 on WIndows 7(32bit). I have create new user in my app but have some problem with login.

When I logged in with newly created superuser then this error message is shown:

>>Error:- Please enter the correct username and password for a staff account. Note that both fields may be case-sensitive.

I followed the Django Girls Tutorial and everything worked fine till I reached the Django Admin part.

The tutorial asks the reader to start the server then create the superuser. I did it the other way round: created the super-user (admin) then started the server (does this make a difference?). Navigated to http://localhost:8000/admin and tried to log in.

The login didn't work. Then, while the server was running, I first created one super-user (gaurav) and then another (sharma) and neither one worked. All three super-users had the same password.

Please someone help me to solve this issue. :)

Maybe you've done this, in which case ignore my answer. But you didn't mention migrations. Your problem would be solved by manage.py migrations then manage.py migrate -- as the superuser needs to be stuck into the database first. It doesn't matter whether the server is running first or second. (You will however run into problems if adding the superuser WHILE the server is running on a localhost environment.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM