Django 2.0 and AsgiRequest Error

706 views
Skip to first unread message

G Broten

unread,
Mar 20, 2018, 5:47:49 PM3/20/18
to Django users
Django Users:
 I've done a Google search on this error, but I haven't found anything relevant:
 AttributeError: 'AsgiRequest' object has no attribute 'user'

So I'm hoping someone has an insight into its root cause and, maybe, a solution.
The full error is shown below:

2018-03-20 15:40:31,079 ERROR    Internal Server Error: /message/
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/django/core/handlers/exception.py", line 35, in inner
    response = get_response(request)
  File "/usr/lib/python3.6/site-packages/django/core/handlers/base.py", line 128, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/usr/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python3.6/site-packages/django/views/generic/base.py", line 69, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/cls_authentication/decorators.py", line 253, in _wrapper
    return bound_func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/django/contrib/auth/decorators.py", line 20, in _wrapped_view
    if test_func(request.user):
AttributeError: 'AsgiRequest' object has no attribute 'user'

Below is the list of installed packages:
aioredis (1.0.0)
amqp (2.2.2)
asgi-redis (1.4.3)
asgiref (2.1.6)
async-timeout (2.0.1)
attrs (17.4.0)
autobahn (18.3.1)
Automat (0.6.0)
billiard (3.5.0.3)
celery (4.1.0)
channels (2.0.2)
channels-redis (2.1.0)
circus (0.14.0)
cls-authentication (1.5.2)
constantly (15.1.0)
daphne (2.0.4)
Django (2.0.3)
django-cas-client (1.4.0)
django-celery-beat (1.1.1)
hiredis (0.2.0)
hyperlink (18.0.0)
idna (2.6)
incremental (17.5.0)
iowait (0.2)
kombu (4.1.0)
msgpack (0.5.6)
msgpack-python (0.5.6)
multidict (4.1.0)
people-connector (1.1.22)
pip (9.0.1)
psutil (5.4.3)
pyepics (3.3.0)
pytz (2016.4)
PyYAML (3.12)
pyzmq (17.0.0)
redis (2.10.6)
requests (2.11.1)
setuptools (28.8.0)
six (1.11.0)
tornado (4.5.3)
Twisted (17.9.0)
txaio (2.9.0)
vcrpy (1.11.1)
vine (1.1.4)
wrapt (1.10.11)
yarl (1.1.1)
zope.interface (4.4.3)

Thanks in advance.

G Broten

Andrew Godwin

unread,
Mar 20, 2018, 6:05:07 PM3/20/18
to django...@googlegroups.com
Hi - did you also open this issue on GitHub: https://github.com/django/channels/issues/981 ?

In either case, your MIDDLEWARE setting would be useful, this looks like a middleware is not running.

Andrew

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1b95bb8d-d5c6-4dec-ba02-746777d26318%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

G Broten

unread,
Mar 21, 2018, 10:54:47 AM3/21/18
to Django users
Andrew:
 No, issue 981 wasn't posted by me, but I too am using MIDDLEWARE_CLASSES so this is most likely the same issue.
I'm looking into it.

Thanks,

G Broten
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

G Broten

unread,
Mar 21, 2018, 11:11:40 AM3/21/18
to Django users
All:
 Yes, this is was identical to GitHub: https://github.com/django/channels/issues/981.
Upgrading to MIDDLEWARE from MIDDLEWARE_CLASSES solved the problem.


G Broten
Reply all
Reply to author
Forward
0 new messages