django request.session throws Atrribute error
<p>I get this error <em>'WSGIRequest' object has no attribute 'session'</em> on the manage.py runserver. When I try to retrieve the session dict from request.session.</p>

<p>Searches on this item say I need to put 'django.contrib.sessions.middleware.SessionMiddleware' on top of the MIDDLEWARE settings. However this does not seem to work.</p>

<p>My settings.py:</p>

<pre><code>import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '@ta=3ful!*bzj^o@3+avt#qrm9@uz%6ur_d@ihs#j--5us*r_('

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ["*"]


# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.sessions',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'FEM',
]

MIDDLEWARE = [
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.middleware.security.SecurityMiddleware',
    'whitenoise.middleware.WhiteNoiseMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'laizen.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
                #'django.core.context_processors.csrf',
            ],
        },
    },
]

WSGI_APPLICATION = 'laizen.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}


# Password validation
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/1.10/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'Europe/Amsterdam'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/

PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))

STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles')
STATIC_URL = '/static/'

# Extra places for collectstatic to find static files.
STATICFILES_DIRS = (
    os.path.join(PROJECT_ROOT, 'static'),
    os.path.join(BASE_DIR, 'FEM', 'static')
)


#STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
</code></pre>

<p>my views.py function:</p>

<pre><code>def new_framework(request):
    print(request.session)
    return render(request, 'FEM/new_framework.html', {'bool_view_el': 'false'})
</code></pre>

<p>Django error:</p>

<pre><code>AttributeError at /new_framework/
'WSGIRequest' object has no attribute 'session'
Request Method: GET
Request URL:    http://127.0.0.1:8000/new_framework/
Django Version: 1.9.6
Exception Type: AttributeError
Exception Value:    
'WSGIRequest' object has no attribute 'session'
Exception Location: C:\Users\vik\Dropbox\Code\Web_Development\FEM_web_test\FEM\views.py in new_framework, line 23
Python Executable:  C:\Anaconda3\python.exe
Python Version: 3.5.2
Python Path:    
['C:\\Users\\vik\\Dropbox\\Code\\Web_Development\\FEM_web_test',
 'C:\\Anaconda3\\python35.zip',
 'C:\\Anaconda3\\DLLs',
 'C:\\Anaconda3\\lib',
 'C:\\Anaconda3',
 'C:\\Anaconda3\\lib\\site-packages',
 'C:\\Anaconda3\\lib\\site-packages\\Sphinx-1.3.5-py3.5.egg',
 'C:\\Anaconda3\\lib\\site-packages\\cryptography-1.0.2-py3.5-win-amd64.egg',
 'C:\\Anaconda3\\lib\\site-packages\\win32',
 'C:\\Anaconda3\\lib\\site-packages\\win32\\lib',
 'C:\\Anaconda3\\lib\\site-packages\\Pythonwin',
 'C:\\Anaconda3\\lib\\site-packages\\setuptools-20.7.0-py3.5.egg']
Server time:    Sun, 28 Aug 2016 12:53:18 +0200
</code></pre>

<p>You are using Django version 1.9; the MIDDLEWARE setting was only introduced in version 1.10. For earlier versions like yours you should be using MIDDLEWARE_CLASSES - or upgrade to 1.10.</p>

python django session