我们将 Django 用于我们的 Python 网站。我们celery==4.1.1
用来运行后台任务。一切正常。但是,我无法像以前在旧 celery 中使用djcelery
. 我听说过flower
。
我用了
flower==0.9.2
tornado==4.5.2
babel==2.5.3
这是主管中的命令:
[program:celery-flower]
command=flower -A lbb --natural-time --url_prefix=flower --port=5555 --inspect --enable-events
这是我的 Nginx 配置:
upstream application {
server lbb-app:8000;
}
upstream application2 {
server lbb-app:5555;
}
server {
listen 80 default_server;
charset utf-8;
client_max_body_size 4G; # adjust to taste
server_tokens off;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header Cache-Control "no-store";
add_header Pragma "no-cache";
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
location /work {
include uwsgi_params;
uwsgi_pass application;
}
# Finally, send all non-media requests to the Django server.
location / {
include uwsgi_params;
uwsgi_pass application;
}
location /flower/ {
include uwsgi_params;
uwsgi_pass application2;
}
}
我无法打开仪表板。它显示 504 错误。
这是来自 celery-flower-stderr 的日志。
[I 180605 08:25:06 command:106] Visit me at http://localhost:5555
[I 180605 08:25:06 command:107] Broker: amqp://guest:**@ec2-xx-2xx-1xx-xx.eu-west-1.compute.amazonaws.com:5672//
[W 180605 08:25:06 state:74] Broker info is not available if --broker_api option is not configured. Also make sure RabbitMQ Management Plugin is enabled (rabbitmq-plugins enable rabbitmq_management)
[I 180605 08:25:06 mixins:224] Connected to amqp://guest:**@ec2-xx-2xx-1xx-xx.eu-west-1.compute.amazonaws.com:5672//
是否--broker-api
必须只显示花卉仪表板?我的设置有问题吗?我应该怎么办?我怀疑这与我的 nginx 配置有关。请指出其中的任何错误。
已编辑
我添加了broker-api=http://guest:**@ec2-xx-2xx-1xx-xx.eu-west-1.compute.amazonaws.com:15672/api/
和 rabbitmq 管理命令。
现在 celery-flower-stderr 中的消息:
[I 180606 03:56:15 command:139] Visit me at http://localhost:5555
[I 180606 03:56:15 command:144] Broker: amqp://guest:**@ec2-xx-2xx-1xx-xx.eu-west-1.compute.amazonaws.com:5672//
[I 180606 03:56:15 command:147] Registered tasks:
['(redacted)',
'celery.accumulate',
'celery.backend_cleanup',
'celery.chain',
'celery.chord',
'celery.chord_unlock',
'celery.chunks',
'celery.group',
'celery.map',
'celery.starmap',
'celery_haystack.tasks.CeleryHaystackSignalHandler',
'celery_haystack.tasks.CeleryHaystackUpdateIndex',]
[I 180606 03:56:15 mixins:224] Connected to amqp://guest:**@ec2-xx-2xx-1xx-xx.eu-west-1.compute.amazonaws.com:5672//
[W 180606 03:56:17 control:44] 'stats' inspect method failed
[W 180606 03:56:17 control:44] 'active_queues' inspect method failed
[W 180606 03:56:17 control:44] 'registered' inspect method failed
[W 180606 03:56:17 control:44] 'scheduled' inspect method failed
[W 180606 03:56:17 control:44] 'active' inspect method failed
[W 180606 03:56:17 control:44] 'reserved' inspect method failed
[W 180606 03:56:17 control:44] 'revoked' inspect method failed
[W 180606 03:56:17 control:44] 'conf' inspect method failed