From 4437e04528e77bcfac9d13a807c6aa062feec3c8 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Tue, 5 Apr 2016 17:19:23 -0700 Subject: [PATCH] Fix circular import issue --- channels/routing.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/channels/routing.py b/channels/routing.py index c311658..afa2946 100644 --- a/channels/routing.py +++ b/channels/routing.py @@ -6,7 +6,6 @@ import importlib from django.core.exceptions import ImproperlyConfigured from django.utils import six -from .handler import ViewConsumer from .utils import name_that_thing @@ -47,6 +46,9 @@ class Router(object): """ # We just add the default Django route to the bottom; if the user # has defined another http.request handler, it'll get hit first and run. + # Inner import here to avoid circular import; this function only gets + # called once, thankfully. + from .handler import ViewConsumer self.add_route(Route("http.request", http_consumer or ViewConsumer())) @classmethod