Closed deshraj closed 8 years ago
My suspicion is that both projects are sharing the same ASGI backend - you need to set one to have a different value for prefix
in its configuration, otherwise, yes, they will all connect to each other and share requests.
@andrewgodwin Thanks for the quick reply. I can show you the current channel_layers config for both the projects.
CHANNEL_LAYERS = {
"default": {
"BACKEND": "asgi_redis.RedisChannelLayer",
"CONFIG": {
"hosts": [("localhost", 6379)],
},
"ROUTING": "vicki.routing.channel_routing",
},
}
and
CHANNEL_LAYERS = {
"default": {
"BACKEND": "asgi_redis.RedisChannelLayer",
"CONFIG": {
"hosts": [("localhost", 6379)],
},
"ROUTING": "gradcam.routing.channel_routing",
},
}
Can you please point me to some link or send me a sample config code?
Yup, they are the same configuration and so they are talking to each other. Docs for asgi_redis are at https://github.com/django/asgi_redis/blob/master/README.rst, but in short, you should add a prefix like so (different for each project):
CHANNEL_LAYERS = {
"default": {
"BACKEND": "asgi_redis.RedisChannelLayer",
"CONFIG": {
"hosts": [("localhost", 6379)],
"prefix": "gradcam",
},
"ROUTING": "gradcam.routing.channel_routing",
},
}
Thanks @andrewgodwin . Channels is working like charm for my projects. :smile:
I am running two Django projects on my staging server. Both of them are using channels. I am running two daphne servers each for one. When I start the workers using
runworker
of both the projects, then I can see that the worker of one project seems to consume the requests of the other project and vice versa and causing problems.The two daphne servers are running at different ports 8004 and 9000. OS: Ubuntu 14.04 Versions:
asgi-redis==0.14.1
asgiref==0.14.0
autobahn==0.16.0
backports.ssl-match-hostname==3.5.0.1
channels==0.17.2
daphne==0.15.0
Django==1.10.1
pika==0.10.0
protobuf==3.0.0
redis==2.10.5
six==1.10.0
Twisted==16.4.1
txaio==2.5.1
uWSGI==2.0.13.1
websocket-client==0.37.0
zope.interface==4.3.2
Also, I am using nginx as webserver. The nginx configuration for both the projects are as follows:
Project 1
Project 2