gpt4 book ai didi

python - 与主管一起运行 Django worker 服务器?

转载 作者:行者123 更新时间:2023-11-28 18:29:03 27 4
gpt4 key购买 nike

我正在尝试使用主管部署我的 Django 应用程序。当我启动 supervisor 时,它会正确启动 daphne,但是工作服务器不会启动。

这是 supervisor.conf(workers block )的代码示例:

[program:runworker]
command=python /home/django/environment/myproject/manage.py runworker
stopsignal=KILL
killasgroup=true

浏览器等待很长时间,然后显示:

 503 Service Unavailable
Worker server failed to respond within time limit.

我还可以补充一点,如果我独立启动进程(不使用任何进程控制系统),它实际上可以工作。我在 Nginx 反向代理后面,但我认为这根本不是问题......

这是主管的输出:

2016-08-17 19:01:09,439 INFO supervisord started with pid 3473
2016-08-17 19:01:10,441 INFO spawned: 'runworker' with pid 3477
2016-08-17 19:01:10,442 INFO spawned: 'daphne' with pid 3478
2016-08-17 19:01:11,421 DEBG 'daphne' stderr output:
2016-08-17 23:01:11,421 INFO Starting server at 0.0.0.0:9000, channel layer myproject.asgi:channel_layer

2016-08-17 19:01:11,519 INFO success: runworker entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2016-08-17 19:01:11,519 INFO success: daphne entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2016-08-17 19:01:11,591 DEBG 'runworker' stderr output:
2016-08-17 23:01:11,591 - INFO - runworker - Running worker against channel layer default (asgi_redis.core.RedisChannelLayer)

2016-08-17 19:01:11,592 DEBG 'runworker' stderr output:
2016-08-17 23:01:11,592 - INFO - worker - Listening on channels http.request, websocket.connect, websocket.disconnect, websocket.receive

最佳答案

您可能需要设置 DJANGO_SETTINGS_MODULE 环境变量。

这个答案提供了一个例子:https://stackoverflow.com/a/26732916/4193

关于python - 与主管一起运行 Django worker 服务器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39007410/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com