diff --git a/roost_backend/consumers.py b/roost_backend/consumers.py index aab4841..bf27336 100644 --- a/roost_backend/consumers.py +++ b/roost_backend/consumers.py @@ -21,7 +21,7 @@ def __init__(self, *args, **kwargs): self.active_tails = set() def receive_json(self, content, **kwargs): - DISPATCH_DICT = { + dispatch_dict = { 'ping': self.on_ping, 'get-messages': self.on_get_messages, 'new-tail': self.on_new_tail, @@ -43,13 +43,13 @@ def receive_json(self, content, **kwargs): async_to_sync(self.channel_layer.group_add)(self.groups[-1], self.channel_name) self.send_json({ 'type': 'ready', - 'msgs': list(DISPATCH_DICT.keys()) + 'msgs': list(dispatch_dict.keys()) }) return # dispatch on message type, close if unrecognized. try: - DISPATCH_DICT[msg_type](content) + dispatch_dict[msg_type](content) except (KeyError, NotImplementedError, self.BadMessage): self.close(code=4005) diff --git a/roost_ng/asgi.py b/roost_ng/asgi.py index ba86c6f..a70c05d 100644 --- a/roost_ng/asgi.py +++ b/roost_ng/asgi.py @@ -16,8 +16,11 @@ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'roost_ng.settings') django.setup() +# These imports can't happen before django.setup(). +# pylint: disable=wrong-import-position import roost_ng.routing from roost_ng.middleware import DaphneRootPathForWebsockets +# pylint: enable=wrong-import-position application = ProtocolTypeRouter({