Skip to content

Commit 6c26537

Browse files
committed
Fix channels import
1 parent 366d1aa commit 6c26537

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

graphql_ws/django_channels.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import json
22

3-
from channels.generic.websockets import JsonWebsocketConsumer
3+
try:
4+
# Channels version > 1 renamed the websockets module to websocket.
5+
from channels.generic.websockets import JsonWebsocketConsumer
6+
except ImportError:
7+
from channels.generic.websocket import JsonWebsocketConsumer
48
from graphene_django.settings import graphene_settings
59

610
from .base import BaseConnectionContext

0 commit comments

Comments
 (0)