question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Django Channels Unresolved Import channels.generic.websockets

See original GitHub issue
  • GraphQL AioWS version: Django 2.1.5
  • Python version: Python 3.6.6 :: Anaconda, Inc.
  • Operating System: macOS Mojave 10.14

Description

I’m trying to set up GraphQL Subscriptions with Django Channels 2, but the code keeps on throwing this error: ModuleNotFoundError: No module named ‘channels.generic.websockets’

What I Did

I checked the Django Channels docs and also the source code of graphql_ws and figured a typo: In the first line of django_channels.py, instead of

from channels.generic.websockets import JsonWebsocketConsumer

should be

from channels.generic.websocket import JsonWebsocketConsumer

reference: https://channels.readthedocs.io/en/latest/topics/consumers.html#jsonwebsocketconsumer

python manage.py runserver

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
SmileyChriscommented, Mar 29, 2021

Django v2+ compatible version merged to master!

1reaction
gotexiscommented, Mar 24, 2019

Well at least I got that part right, switching to Node…

HAHAHAHA…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does django-channels not connect to secure Websockets ...
I was able to connect on localhost with some changes. Before that changes it does not work even for ws:// protocol. So my...
Read more >
Channels Documentation
Channels is a project that takes Django and extends its abilities beyond HTTP - to handle WebSockets, chat protocols,.
Read more >
Simple example of using channels in django web framework
Implement django-channels with how-to, Q&A, fixes, code snippets. kandi ratings ... from channels.generic.websocket import AsyncWebsocketConsumer class ...
Read more >
Sending notifications with Django channels
I use Django Channel for sending notifications to users who are ... from channels.generic.websocket import AsyncJsonWebsocketConsumer from ...
Read more >
Django Channels 2.0 websocket crashing & blocking while ...
from channels.generic.websocket import AsyncWebsocketConsumer. import json. class MyConsumer(AsyncWebsocketConsumer):. async def connect(self):.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found