Deploying Django channel with redis

Please explain to me how to Deploy the Django channel project which uses Redis on render.
my dough is how should i set hosts value in settings.py if i want to use redis free instance from render. i am new to these topic so if someone have link to full tutorial or blog, it will be very helpful
CHANNEL_LAYERS={
‘default’:{
‘BACKEND’:‘channels_redis.core.RedisChannelLayer’,
‘CONFIG’:{
‘hosts’:[(‘127.0.0.1’,6379)]
}
}
}

Hi,

The Redis host would not be on 127.0.0.1, you’ll need to use the connection details of your Redis instance.

This is covered in the docs here: https://docs.render.com/redis#connecting-to-your-redis-from-services-on-render

Alan

Thank you for your quick reply,

for example
if my Redis instance on render has the service address: redis://red-c6na6rjru51t7lilgs3g:6379 then i should have
CHANNEL_LAYERS={
‘default’:{
‘BACKEND’:‘channels_redis.core.RedisChannelLayer’,
‘CONFIG’:{
‘hosts’:[(redis://red-c6na6rjru51t7lilgs3g:6379)]
}
}
} in my Django setting.py file, am I right?

Maybe refer to the Django channels_redis repo for the correct syntax: https://github.com/django/channels_redis

That is an internal Redis URL so would only work if being called from another Render service in the same account and region.

Alan

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.