File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from channels import __version__ as channels_version
12from channels .routing import ProtocolTypeRouter , URLRouter
23from channels .sessions import SessionMiddlewareStack
4+ from django .utils .version import get_version_tuple
35from django .apps import apps
46from django .urls import path
57from .consumers import GraphQLSubscriptionConsumer
1012 AuthMiddlewareStack = None
1113
1214
13- websocket_urlpatterns = [path ("subscriptions" , GraphQLSubscriptionConsumer )]
15+ channels_version_tuple = get_version_tuple (channels_version )
16+
17+
18+ if channels_version_tuple > (3 , 0 , 0 ):
19+ websocket_urlpatterns = [path ("subscriptions" , GraphQLSubscriptionConsumer .as_asgi ())]
20+ else :
21+ websocket_urlpatterns = [path ("subscriptions" , GraphQLSubscriptionConsumer )]
1422
1523application = ProtocolTypeRouter ({"websocket" : URLRouter (websocket_urlpatterns )})
1624
Original file line number Diff line number Diff line change 5757 channels ==1.*; python_version<"3"
5858 django ==2.*; python_version>="3"
5959 channels ==2.*; python_version>="3"
60+ django ==3.*; python_version>="3"
61+ channels ==3.*; python_version>="3"
6062 aiohttp; python_version>="3.5"
6163
6264[bdist_wheel]
You can’t perform that action at this time.
0 commit comments