什么是route_class替代品?

时间:2019-07-29 03:19:18

标签: python django channels

我正在关注有关Django的GraphQL订阅的教程。 但是在路由通道上没有“ route_class”成员。 但是我找不到原因。 有人知道如何使用频道路由吗?

class Suscription(ObjectType):
  count_seconds = Int(up_to=Int())

  def resolve_count_seconds(root, info, up_to=5):
    return Observable.interval(1000).map(lambda i: "{0}".format(i))\
      .take_while(lambda i: int(i) <= up_to)

ROOT_SCHEMA = graphene.Schema(query=Query, mutation=Mutation, suscription=Suscription)

#urls
from channels.routing import route_class # route_class does not exists
from graphql_ws.django_channels import GraphQLSubscriptionConsumer
channel_routes = [
  route_class(GraphQLSubscriptionConsumer, path='subscriptions')
]

0 个答案:

没有答案