Unable log in to the django admin page with a valid username and password
Steps to debug:
- Make sure that your Database is synced
- Double check that you have a django_session table
- Try to authenticate
- Do you see a record being created in the
django_session
table?
- Do you see a record being created in the
IF NOT
- remove non-standard settings
- AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend',)
- SESSION_EXPIRE_AT_BROWSER_CLOSE = True
- SESSION_SAVE_EVERY_REQUEST = True
- SESSION_COOKIE_AGE = 86400 # sec
- SESSION_COOKIE_DOMAIN = None
- SESSION_COOKIE_NAME = 'DSESSIONID'
- SESSION_COOKIE_SECURE = False
- Make sure that your Database is synced
- Double check that you have a
django_session
table
- Double check that you have a
- Try to authenticate
- Do you see a record being created in the
django_session
table?
- Do you see a record being created in the
Let me know if this turns up any useful debug.
Sample settings file: https://github.com/fyaconiello/Django-Blank-Bare-Bones-CMS/blob/master/dbbbcms/settings.py
I had this problem. The issue is that in production I set two variables to True
that allowed me to connect to the site using https.
SESSION_COOKIE_SECURE
and CSRF_COOKIE_SECURE
should be set to False
if you are developing on localhost http. Changing these two variables to False
allowed me to sign into the admin site when developing locally.