• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

179
Views
Django Middleware Error - Middleware changed for 1.7

Whenever I run my local server with my django project I am getting a warning and an error message saying that in Django 1.7 the global middleware classes were changed - even though I am using 1.8. My blog, at http://127.0.0.1:8000/, loads fine, but when I try to load the admin site I get AttributeError at /admin/ 'WSGIRequest' object has no attribute 'user', which as far as I can tell is to do with the Middleware. Thanks for your help in advance

EDIT: My middleware:

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

Error message:

Warnings
?: (1_7.W001) Middleware_Classes is not set.
    Hint: Django 1.7 changed the global defaults for the middleware_classes. django.contrib.auth.middleware.AuthenticationMiddleware, django.contrib.sessions.middleware.SessionMiddleware, and django.contrib.messages.middleware.MessageMiddleware, were removed from the defaults. If your project needs this middleware then you should configure this middleware.
over 3 years ago · Santiago Trujillo
2 answers
Answer question

0

The MIDDLEWARE setting was introduced in Django 1.10. If you are using Django 1.9 or earlier it will have no effect, and you should be using the MIDDLEWARE_CLASSES setting instead.

Make sure you are using the correct version of the docs (e.g. Django 1.8, Django 1.11), so that you follow the correct instructions.

over 3 years ago · Santiago Trujillo Report

0

I created my project using django 1.11 but when I transferred the files to the web server, I encountered errors with fcgi which forced me to downgrade to 1.8. Therefore the error came up because admin was now expecting MIDDLEWARE_CLASSES instead of MIDDLEWARE. Changing that solved the error.

over 3 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error