Stack
Stack

Reputation: 1129

Way of Avoid Docker on Django Channels

I'm developing an app with django and althougth I don't understant Docker, I ended with this code for establish the connections on django channels:

sudo docker run -p 6379:6379 -d redis:5

And settings.py:

CHANNEL_LAYERS = {
    'default': {
        'BACKEND': 'channels_redis.core.RedisChannelLayer',
        'CONFIG': {
            "hosts": [('127.0.0.1', 6379)],
        },
    },
}

I'm facing losts of issues trying to obtain the same result without need to use that. (technical requirements, I can't use Docker) I'm sorry if the question is dumb, but is there any way of running that port connection without docker?

Upvotes: 0

Views: 1072

Answers (1)

matyas
matyas

Reputation: 2796

In order to be able to use django-channels you need to have redis running on your system. Redis can be used for many things (it is used as message-broker in django-channels) and you can install it either through docker as you did or regularly on your operating system.

For example to install redis on your ubuntu operating system you can run

sudo apt-get install redis-server

you can then always start the redis server before running your Django Channels project with the command

redis-server

To avoid that you can configure redis to start everytime after you boot up your operating system like this:

sudo systemctl enable redis-server.service

Upvotes: 3

Related Questions