【发布时间】:2017-11-28 15:57:09
【问题描述】:
我一直在关注这篇文章-https://blog.mangoforbreakfast.com/2017/02/13/django-channels-on-aws-elastic-beanstalk-using-an-alb/
让我的 django-channels 应用程序在 aws 上运行..但只有非 websockets 请求得到处理。
我的频道层设置是:
CHANNEL_LAYERS = {
"default": {
"BACKEND": "asgi_redis.RedisChannelLayer",
"CONFIG": {
"hosts": [os.environ.get('REDIS_URL', 'redis://localhost:6379')],
},
"ROUTING": "malang.routing.channel_routing",
},
}
我有文章中提到的两个目标群体。一条转发路径 / 到端口 80 和 /ws/* 到 5000。
我的 supervisord.conf 是 -
[program:Daphne]
environment=PATH="/opt/python/run/venv/bin"
command=/opt/python/run/venv/bin/daphne -b 0.0.0.0 -p 5000
malang.asgi:channel_layer
directory=/opt/python/current/app
autostart=true
autorestart=true
redirect_stderr=true
user=root
stdout_logfile=/tmp/daphne.out.log
[program:Worker]
environment=PATH="/opt/python/run/venv/bin"
command= /opt/python/run/venv/bin/python manage.py runworker
directory=/opt/python/current/app
process_name=%(program_name)s_%(process_num)02d
numprocs=4
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/tmp/workers.out.log
当我在 aws 日志上检查 supervisorctl 状态的结果时,它显示它们运行良好。但我仍然得到 ws 的 404 响应。
如果您想了解更多信息,请帮助并告诉我..
【问题讨论】:
-
我正在尝试同样的事情,使用应用程序负载均衡器。你能帮帮我吗?
标签: python django amazon-web-services django-channels daphne