Django: ‘WSGIRequest’ object has no attribute ‘user’

One of those “aw, crap” moments where everything was working fine one day and then you can’t get into the admin interface the next.

Thankfully, the reason is pretty simple. It stems from subtle changes made between Django versions 1.9 and 1.10– more specifically, the name of the MIDDLEWARE constant in settings.py changed from MIDDLEWARE to MIDDLEWARE_CLASSES.

In my case, this resulted because I have two virtualenvs– one running 1.9, the other running 1.10, and I fired up the wrong one when launching the dev server.

Leave a Reply