在线检查用户 Django 1.10
Check User online Django 1.10
您好,尝试像示例中那样做:
但是添加的时候
'userprofile.middleware.ActiveUserMiddleware',
至 MIDDLEWARE_CLASSES
收到下一个错误:
Unhandled exception in thread started by <function wrapper at 0x7fcf6e0b8668>
Traceback (most recent call last):
File "/home/pavlo/.local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/home/pavlo/.local/lib/python2.7/site-packages/channels/management/commands/runserver.py", line 40, in inner_run
http_consumer=self.get_consumer(*args, **options),
File "/home/pavlo/.local/lib/python2.7/site-packages/channels/management/commands/runserver.py", line 136, in get_consumer
return StaticFilesConsumer()
File "/home/pavlo/.local/lib/python2.7/site-packages/channels/handler.py", line 332, in __init__
self.handler = self.handler_class()
File "/home/pavlo/.local/lib/python2.7/site-packages/channels/staticfiles.py", line 18, in __init__
super(StaticFilesHandler, self).__init__()
File "/home/pavlo/.local/lib/python2.7/site-packages/channels/handler.py", line 179, in __init__
self.load_middleware()
File "/home/pavlo/.local/lib/python2.7/site-packages/django/core/handlers/base.py", line 82, in load_middleware
mw_instance = middleware(handler)
TypeError: this constructor takes no arguments
谢谢帮助。
可能有人建议如何在 Django 1.10
中检查 online/offline 用户
Django 1.10 中的中间件已更改,请参阅 this guide how to upgrade them
您好,尝试像示例中那样做:
但是添加的时候
'userprofile.middleware.ActiveUserMiddleware',
至 MIDDLEWARE_CLASSES
收到下一个错误:
Unhandled exception in thread started by <function wrapper at 0x7fcf6e0b8668>
Traceback (most recent call last):
File "/home/pavlo/.local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/home/pavlo/.local/lib/python2.7/site-packages/channels/management/commands/runserver.py", line 40, in inner_run
http_consumer=self.get_consumer(*args, **options),
File "/home/pavlo/.local/lib/python2.7/site-packages/channels/management/commands/runserver.py", line 136, in get_consumer
return StaticFilesConsumer()
File "/home/pavlo/.local/lib/python2.7/site-packages/channels/handler.py", line 332, in __init__
self.handler = self.handler_class()
File "/home/pavlo/.local/lib/python2.7/site-packages/channels/staticfiles.py", line 18, in __init__
super(StaticFilesHandler, self).__init__()
File "/home/pavlo/.local/lib/python2.7/site-packages/channels/handler.py", line 179, in __init__
self.load_middleware()
File "/home/pavlo/.local/lib/python2.7/site-packages/django/core/handlers/base.py", line 82, in load_middleware
mw_instance = middleware(handler)
TypeError: this constructor takes no arguments
谢谢帮助。
可能有人建议如何在 Django 1.10
中检查 online/offline 用户Django 1.10 中的中间件已更改,请参阅 this guide how to upgrade them