title: Installing Channels: Python Django version and settings
body: <p>I'm trying to add <code>Channels</code> to my app by following this tutorial:
  <a href="https://blog.heroku.com/in_deep_with_django_channels_the_future_of_real_time_apps_in_django" rel="nofollow noreferrer">https://blog.heroku.com/in_deep_with_django_channels_the_future_of_real_time_apps_in_django</a></p>
  
  <p>The Django app compiles, but when I try to run it:</p>
  
  <pre><code>(virtualenv) root@computer:path# python manage.py runserver 0.0.0.0:8000
  </code></pre>
  
  <p>It gives error:</p>
  
  <pre><code>  File "/root/.virtualenvs/codebench/local/lib/python2.7/site-packages/channels/routing.py", line 75, in resolve_routing
      raise ImproperlyConfigured("Cannot import channel routing %r: %s" % (routing, e))
  ImproperlyConfigured: Cannot import channel routing 'codebench.routing.channel_routing': cannot import name ProtocolTypeRouter
  </code></pre>
  
  <p>According to this
  <a href="https://github.com/VincentTide/django-channels-celery-example/issues/1" rel="nofollow noreferrer">https://github.com/VincentTide/django-channels-celery-example/issues/1</a>
  It maybe related to Python version, so I did:</p>
  
  <pre><code>(virtualenv) root@computer:path# alias python=python3
  (virtualenv) root@computer:path# python -V
  Python 3.5.2
  (virtualenv) root@computer:path# python manage.py runserver 0.0.0.0:8000
  Traceback (most recent call last):
    File "manage.py", line 3, in &lt;module&gt;
      import eventlet
  ImportError: No module named 'eventlet'
  (virtualenv) root@computer:path# pip install eventlet
  Requirement already satisfied: eventlet in /root/.virtualenvs/codebench/lib/python2.7/site-packages
  Requirement already satisfied: greenlet&gt;=0.3 in /root/.virtualenvs/codebench/lib/python2.7/site-packages (from eventlet)
  Requirement already satisfied: enum-compat in /root/.virtualenvs/codebench/lib/python2.7/site-packages (from eventlet)
  Requirement already satisfied: enum34 in /root/.virtualenvs/codebench/lib/python2.7/site-packages (from enum-compat-&gt;eventlet)
  </code></pre>
  
  <p>Now I stuck at: <code>ImportError: No module named 'eventlet'</code></p>
  
  <p>I have the following packages installed:</p>
  
  <pre><code>channels==1.1.6
  daphne==1.4.0
  Django==1.9
  eventlet==0.20.0
  </code></pre>
  
  <p>If I follow this tutorial: <a href="http://channels.readthedocs.io/en/1.x/getting-started.html" rel="nofollow noreferrer">http://channels.readthedocs.io/en/1.x/getting-started.html</a></p>
  
  <pre><code>System check identified 1 issue (0 silenced).
  February 16, 2018 - 23:19:32
  Django version 1.9, using settings 'codebench.settings'
  Starting Channels development server at http://0.0.0.0:8000/
  Channel layer default (asgiref.inmemory.ChannelLayer)
  Quit the server with CONTROL-C.
  2018-02-16 23:19:32,935 - INFO - worker - Listening on channels http.request, websocket.connect, websocket.disconnect, websocket.receive
  2018-02-16 23:19:32,935 - INFO - worker - Listening on channels http.request, websocket.connect, websocket.disconnect, websocket.receive
  2018-02-16 23:19:32,935 - INFO - worker - Listening on channels http.request, websocket.connect, websocket.disconnect, websocket.receive
  2018-02-16 23:19:32,936 - INFO - worker - Listening on channels http.request, websocket.connect, websocket.disconnect, websocket.receive
  Traceback (most recent call last):
    File "/root/.virtualenvs/codebench/local/lib/python2.7/site-packages/eventlet/hubs/hub.py", line 457, in fire_timers
      timer()
    File "/root/.virtualenvs/codebench/local/lib/python2.7/site-packages/eventlet/hubs/timer.py", line 58, in __call__
      cb(*args, **kw)
    File "/root/.virtualenvs/codebench/local/lib/python2.7/site-packages/eventlet/semaphore.py", line 145, in _do_acquire
      waiter.switch()
    File "/root/.virtualenvs/codebench/local/lib/python2.7/site-packages/eventlet/green/thread.py", line 41, in __thread_body
      func(*args, **kwargs)
    File "/root/.virtualenvs/codebench/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
      fn(*args, **kwargs)
    File "/root/.virtualenvs/codebench/local/lib/python2.7/site-packages/channels/management/commands/runserver.py", line 99, in inner_run
      websocket_handshake_timeout=self.websocket_handshake_timeout,
    File "/root/.virtualenvs/codebench/local/lib/python2.7/site-packages/daphne/server.py", line 101, in run
      websocket_handshake_timeout=self.websocket_handshake_timeout
  TypeError: __init__() got an unexpected keyword argument 'proxy_forwarded_proto_header'
  </code></pre>
  
  <hr>
  
  <p>If I upgrade everything, except Python 2.7.12: </p>
  
  <pre><code>asgi-redis==1.4.3
  asgiref==2.1.5
  channels==2.0.2
  daphne==2.0.3
  Django==1.11.10
  </code></pre>
  
  <p><code>runserver</code> will give:</p>
  
  <pre><code>  File "/root/.virtualenvs/codebench/local/lib/python2.7/site-packages/channels/apps.py", line 6, in &lt;module&gt;
      import daphne.server  # noqa
    File "/root/.virtualenvs/codebench/local/lib/python2.7/site-packages/daphne/server.py", line 192
      async def handle_reply(self, protocol, message):
              ^
  SyntaxError: invalid syntax
  </code></pre>
  
  <p>If I try to reinstall all required packages under Python 3.5.2:</p>
  
  <p>Need this for <code>twisted</code>:</p>
  
  <pre><code>apt install python3.6-dev
  </code></pre>
  
  <p><a href="https://askubuntu.com/questions/966939/failed-building-wheel-for-twisted">https://askubuntu.com/questions/966939/failed-building-wheel-for-twisted</a></p>
  
  <p>Now I'm getting random errors:</p>
  
  <pre><code>2018-02-18 14:03:51,634 - ERROR - server - Exception inside application: 'NoneType' object has no attribute 'writeSequence'
    File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step
      result = coro.throw(exc)
    File "/root/.virtualenvs/python3/lib/python3.5/site-packages/channels/http.py", line 191, in __call__
      await self.handle(body)
    File "/root/.virtualenvs/python3/lib/python3.5/site-packages/asgiref/sync.py", line 108, in __call__
      return await asyncio.wait_for(future, timeout=None)
    File "/usr/lib/python3.5/asyncio/tasks.py", line 373, in wait_for
      return (yield from fut)
    File "/usr/lib/python3.5/asyncio/futures.py", line 361, in __iter__
      yield self  # This tells Task to wait for completion.
    File "/usr/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup
      future.result()
    File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
      raise self._exception
    File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
      result = self.fn(*self.args, **self.kwargs)
    File "/root/.virtualenvs/python3/lib/python3.5/site-packages/asgiref/sync.py", line 123, in thread_handler
      return self.func(*args, **kwargs)
    File "/root/.virtualenvs/python3/lib/python3.5/site-packages/channels/http.py", line 227, in handle
      self.send(response_message)
    File "/root/.virtualenvs/python3/lib/python3.5/site-packages/asgiref/sync.py", line 62, in __call__
      return call_result.result()
    File "/usr/lib/python3.5/concurrent/futures/_base.py", line 405, in result
      return self.__get_result()
    File "/usr/lib/python3.5/concurrent/futures/_base.py", line 357, in __get_result
      raise self._exception
    File "/root/.virtualenvs/python3/lib/python3.5/site-packages/asgiref/sync.py", line 76, in main_wrap
      result = await self.awaitable(*args, **kwargs)
    File "/root/.virtualenvs/python3/lib/python3.5/site-packages/daphne/server.py", line 196, in handle_reply
      protocol.handle_reply(message)
    File "/root/.virtualenvs/python3/lib/python3.5/site-packages/daphne/http_protocol.py", line 210, in handle_reply
      http.Request.write(self, message.get("body", b""))
    File "/root/.virtualenvs/python3/lib/python3.5/site-packages/twisted/web/http.py", line 1084, in write
      self.channel.writeSequence(toChunk(data))
    'NoneType' object has no attribute 'writeSequence'
  </code></pre>
  
  <p>Also:</p>
  
  <pre><code>(python3) root@computer:path# python manage.py shell
  Python 3.5.2 (default, Nov 23 2017, 16:37:01) 
  [GCC 5.4.0 20160609] on linux
  Type "help", "copyright", "credits" or "license" for more information.
  (InteractiveConsole)
  &gt;&gt;&gt; import channels
  &gt;&gt;&gt; print(channels.__file__)
  /root/.virtualenvs/python3/lib/python3.5/site-packages/channels/__init__.py
  &gt;&gt;&gt; from channels import Group
  Traceback (most recent call last):
    File "&lt;console&gt;", line 1, in &lt;module&gt;
  ImportError: cannot import name 'Group'
  </code></pre>