django-user_agents icon indicating copy to clipboard operation
django-user_agents copied to clipboard

'WSGIRequest' object has no attribute 'user_agent'

Open lowegreg opened this issue 6 years ago • 5 comments

If anyone can help with this error I'd be very appreciative. I think I have the settings correct:

INSTALLED_APPS = ( '... Lots of apps', 'django_user_agents' )

MIDDLEWARE_CLASSES = ( '... Lots of middleware', 'django_user_agents.middleware.UserAgentMiddleware' )

Traceback (most recent call last): File "/Users/Greg/Development/propel/lib/python2.7/site-packages/django/core/handlers/exception.py", line 42, in inner response = get_response(request) File "/Users/Greg/Development/propel/lib/python2.7/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response response = self._get_response(request) File "/Users/Greg/Development/propel/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response response = self.process_exception_by_middleware(e, request) File "/Users/Greg/Development/propel/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/Users/Greg/Development/propel/lib/python2.7/site-packages/django/views/generic/base.py", line 68, in view return self.dispatch(request, *args, **kwargs) File "/Users/Greg/Development/propel/lib/python2.7/site-packages/django/views/generic/base.py", line 88, in dispatch return handler(request, *args, **kwargs) File "/Users/Greg/Google Drive/Propel/PropelSurveySolutions/questionnaire/views.py", line 42, in post print self.request.user_agent.is_mobile AttributeError: 'WSGIRequest' object has no attribute 'user_agent'

lowegreg avatar Oct 12 '18 20:10 lowegreg

Check if AuthenticationMiddleware is missing from your middleware classes.

goobie avatar Dec 21 '18 07:12 goobie

I have the same error, and it's not missing

Kalightortaio avatar Mar 24 '19 00:03 Kalightortaio

Also same error here !! Still bug not fixed ?

meibassam avatar Apr 08 '20 06:04 meibassam

My middleware and installed_apps settings are set but still getting this error as well!

Tamupiwa avatar May 12 '20 11:05 Tamupiwa

I get the same error

Mujirin avatar Oct 13 '21 01:10 Mujirin