G
G
gromyko212020-09-29 10:25:12
Django
gromyko21, 2020-09-29 10:25:12

Websocket(redis) don't want to work connectionRefusedError: [Errno 111] onnect call failed ('134.0.113.144', 6379)?

I'm testing the project on the server. I want to check the work of channels 2. But there are errors in the radish

ConnectionRefusedError: [Errno 111] Connect call failed ('134.0.113.144', 6379)
134.0.113.144 it catches my vps

settings
ALLOWED_HOSTS = ['имя хоста']

REDIS_HOST = 'имя хоста'
REDIS_PORT = 6379
REDIS_DB = 0
INSTALLED_APPS = [
    'channels',
    'rest_framework',
]
CHANNEL_LAYERS = {
    'default': {
        'BACKEND': 'channels_redis.core.RedisChannelLayer',
        'CONFIG': {
            "hosts": [('имя хоста', 6379)],
        },
    },
}

Googled a lot and did not find a solution for myself.
redis 3.5.3
redis-server 5.0.7
aioredis 1.3.1 Redis
itself works when tested separately.
Question bonus
И есть вопрос бонусом: когда ставишь debug:False пропадают стили в админке. На эту тему много инфы, но я толком не смог разобраться. Добавлял STATIC_ROOT = '/var/www/www-root/data/ss.tnmk.ru:8000/staticfiles/' (в static_url лежит просто static), потом делал collectstatic, он создавал мне папку, где были мои файлы + файлы админки. Админа их запрашивала(путь был корректный), но оно почему-то все равно не грузилось.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2020-09-29
@gromyko21

Django and Redis have nothing to do with it. You need to make sure that the host where the django project is running can connect to the host where Redis is running.

Reply with a bonus
Эта инфа есть в документации. В рабочем режиме статику должен обслуживать web-сервер.

V
Vladimir, 2020-09-29
@AstraVlad

According to the "bonus", everything works for me only if I put in the debug

STATIC_ROOT = ''
STATICFILES_DIRS = (
        os.path.join(BASE_DIR, 'static'),
)

and in production: And nothing else. In both cases:
STATIC_ROOT = 'static/'
STATIC_URL = '/static/'
STATIC_BASE = os.path.join(BASE_DIR, 'static/')

But I'm developing on Win. I myself have not figured out this magic yet :).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question