SessionStore object has no attribute 'get_session_cookie_age'
I have a Django project, everything goes well, but when I tried to handle the expiration of the session I got confused
In a test view print(request.session.get_session_cookie_age())
give me this error SessionStore' object has no attribute get_session_cookie_age
According to the documentation it should returns the value of the setting SESSION_COOKIE_AGE
Trying debugging with this code :
from django.contrib.sessions.models import Session
sk = request.session.session_key
s = Session.objects.get(pk=sk)
pprint(s.get_decoded())
>>> {'_auth_user_backend': 'django.contrib.auth.backends.ModelBackend',
'_auth_user_hash': '055c9b751ffcc6f3530337321e98f9e5e4b8a623',
'_auth_user_id': '6',
'_session_expiry': 3600}
Here is the config :
Version Django = 2.0
Python 3.6.9
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.postgres',
'corsheaders',
'rest_framework',
'rest_framework.authtoken',
'drf_yasg',
'wkhtmltopdf',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'corsheaders.middleware.CorsMiddleware',
]
Thank's in advance
That functionality is not in Django 2.0, see here.