jazzband / django-debug-toolbar

A configurable set of panels that display various debug information about the current request/response.
https://django-debug-toolbar.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
7.96k stars 1.03k forks source link

'WSGIRequest' object has no attribute 'user' #550

Closed danbruegge closed 10 years ago

danbruegge commented 10 years ago

Hi,

i use django 1.6.2 and the django-debug-toolbar in version 1.0.1

The error occurs on a project i've updated from django 1.4.9 and djang-debug-toolbar 0.8.5.

If i remove the ddt from the settings.py/development.py all works fine. If enabled, the ddt also seems to be working but i get this error.

I can not figure out why the problem occurs. All my other projects are working fine with django 1.6.2 and ddj 1.0.1.

Here is my traceback: https://gist.github.com/haengebruegge/9052453

I also found an issue that has the same error message but with another reason: https://github.com/django-debug-toolbar/django-debug-toolbar/issues/399

jnns commented 10 years ago

The problem seems to be that Django Debug Toolbar's middleware is loaded before Django's AuthenticationMiddleware added user to the request object.

You should configure the Django Debug Toolbar explicitly and insert the toolbar middleware after the authentication middleware.

aaugustin commented 10 years ago

The gist has disappeared, I assume the answer above has resolved the issue.