Django channels times out with daphne and worker
<p>I have a problem with django channels.
My Django app was running perfectly with WSGI for HTTP requests.
I tried to migrate to channels in order to allow websocket requests, and it turns out that after installing channels and running ASGI (daphne) and a worker, the server answers error 503 and the browser displays error 504 (time out) for the http requests that were previously working (admin page for example).
I read all the tutorial I could find and I do not see what the problem can be. Moreover, if I run with "runserver", it works fine.</p>

<p>I have an Nginx in front of the app (on a separate server), working as proxy and loadbalancer.
I use Django 1.9.5 with asgi-redis>=0.10.0, channels>=0.17.0 and daphne>=0.15.0. The wsgi.py and asgi.py files are in the same folder. Redis is working.</p>

<p>The command I was previously using with WSGI (and which still works if I switch back to it) is:
<code>uwsgi --http :8000 --master --enable-threads --module Cats.wsgi</code></p>

<p>The command that works using runserver is:
<code>python manage.py runserver 0.0.0.0:8000</code></p>

<p>The commands that fail for the requests that work with the 2 other commands are:
<code>daphne -b 0.0.0.0 -p 8000 Cats.asgi:channel_layer 
python manage.py runworker</code></p>

<p>Other info:
I added 'channels' in the installed apps (in settings.py)</p>

<p>other settings.py relevant info</p>

<pre><code>CHANNEL_LAYERS = {
"default": {
    "BACKEND": "asgi_redis.RedisChannelLayer",
    "ROUTING": "Cats.routing.app_routing",
    "CONFIG": {
        "hosts": [(os.environ['REDIS_HOST'], 6379)],
    },
},
</code></pre>

<p>}</p>

<p>Cats/routing.py</p>

<pre><code>from channels.routing import route, include
from main.routing import routing as main_routing

app_routing = [
    include(main_routing, path=r"^/ws/main"),
]
</code></pre>

<p>main/routing.py</p>

<pre><code>from channels.routing import route, include

http_routing = [
]

stream_routing = [
    route('websocket.receive', 'main.consumers.ws_echo'), #just for test once it will work
]

routing = [
    include(stream_routing),
    include(http_routing),
]
</code></pre>

<p>main/consumers.py</p>

<pre><code>def ws_echo(message):
message.reply_channel.send({
    'text': message.content['text'],
})

#this consumer is just for test once it will work
</code></pre>

<p>Any idea what could be wrong? All help much appreciated! Ty</p>

<p>EDIT:
I tried a new thing:</p>

<pre><code>python manage.py runserver 0.0.0.0:8000 --noworker
python manage.py runworker
</code></pre>

<p>And this does not work, while <code>python manage.py runserver 0.0.0.0:8000</code> was working...</p>

<p>Any idea that could help?</p>