I was working through the polls tutorial and everything was fine until I tried to log in to the admin site; it just said
"Please enter the correct username and password for a staff account. Note that both fields may be case-sensitive."
So I Googled the issue and tried everything I could. Here are all the problems I investigated:
django_session
table: I checked; it's there.'polls.apps.PollsConfig',
to INSTALLED_APPS
.is_staff
, is_superuser
, and is_active
are all True
.django_session
table and it's empty.url(r"^admin/", admin.site.urls)
in mysite/urls.py.python manage.py runserver
.Is there anything I haven't tried yet, or am I missing something?
This could also happen if the database being used is the default sqlite3 database and the settings.py has the DATABASES property referring to a db.sqlite3 file that is NOT in the same directory as manage.py is.
I guess you would have created this user through other ways and not python manage.py createsuperuser
This happens when you have two authentication systems. ie.,. you might have django inbuilt authentication and (for example) DRF token based authentication.
To login to the backend(django admin) you will have to use python manage.py createsuperuser
To change the pwd, use the below,
python manage.py changepassword
Sometimes the simplest solutions can solve huge problems. For me it was enough to comment out or delete:
SESSION_COOKIE_SECURE = True
That's all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With