1

我刚开始使用 Flower 进行 Celery 任务监控。一切都在本地运行良好。但是当我将代码部署到服务器并尝试打开花页时,我收到以下错误

[pid: 6442|app: 0|req: 20/20] 46.19.100.110 () {44 vars in 935 bytes}       
[Thu Mar 10 06:38:39 2016] GET /static/js/bootstrap-collapse.js?v=e8ddac0b5dd49cfbcf7d3ca8b0098d7b => generated 1852 bytes in 22 msecs (HTTP/1.1 404) 2 headers in 80 bytes (1 switches on core 0)

Not Found: /static/js/bootstrap-carousel.js

[pid: 6442|app: 0|req: 21/21] 46.19.100.110 () {44 vars in 935 bytes}      
[Thu Mar 10 06:38:39 2016] GET /static/js/bootstrap-carousel.js?v=fc8cbc40f39316b8b567b3b96efe9044 => generated 1852 bytes in 24 msecs (HTTP/1.1 404) 2 headers in 80 bytes (1 switches on core 0)

Not Found: /static/js/d3.min.js
[pid: 6442|app: 0|req: 22/22] 46.19.100.110 () {44 vars in 911 bytes}    
[Thu Mar 10 06:38:39 2016] GET /static/js/d3.min.js?v=eb68d3d1035789d336b285373046b550 => generated 1816 bytes in 23 msecs (HTTP/1.1 404) 2 headers in 80 bytes (1 switches on core 0)

Not Found: /static/js/rickshaw.min.js

[pid: 6442|app: 0|req: 23/23] 46.19.100.110 () {44 vars in 923 bytes}  
[Thu Mar 10 06:38:39 2016] GET /static/js/rickshaw.min.js?v=fc927b6dd64118caa563b711bcb2f130 => generated 1834 bytes in 21 msecs (HTTP/1.1 404) 2 headers in 80 bytes (1 switches on core 0)

Not Found: /static/js/bootstrap-datetimepicker.min.js

[pid: 6442|app: 0|req: 24/24] 46.19.100.110 () {44 vars in 955 bytes}    
[Thu Mar 10 06:38:39 2016] GET /static/js/bootstrap-datetimepicker.min.js?v=8880b6a34ee02b5cb6a75f92b3a7ddc9 => generated 1882 bytes in 19 msecs (HTTP/1.1 404) 2 headers in 80 bytes (1 switches on core 0)
Not Found: /static/js/flower.js

有任何想法吗?

这是 nginx 配置文件

upstream admin_backend {
    server {{ backend_host }}:{{ backend_port }};
}

upstream flower_backends {
    server {{ backend_host }}:{{ flower_port }};
}

server {
    listen  80;
    server_name     admin{{ suffix }}.skycryptor.com;
    rewrite     ^ https://admin{{ suffix }}.skycryptor.com last;
}

server {
    listen 443 ssl;
    server_name admin{{ suffix }}.skycryptor.com;

client_max_body_size 100M;
location / {
    uwsgi_pass admin_backend;
    include uwsgi_params;
}

location /flower {
    proxy_pass_header Server;
    proxy_pass http://flower_backends;
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Scheme $scheme;
    proxy_next_upstream error;
}

location /robots.txt {
    alias /opt/static/robots.txt;
}
}

我认为 Flower 正在正常运行,这是来自日志文件的消息

Executing /opt/worker/runenv/bin/celery --app=skyworker flower --port=5555 in /opt/worker/runenv
4

1 回答 1

5

在早期版本的花中,它有一个命令行参数--url-prefix=flower。它使用户能够在 URL 路径上运行 Flower,例如/flower. 在最近的版本中,这个参数被弃用了,flower 的 pypi 版本(0.8.4)只能在子域上运行,flower.example.com但不能在 URL 路径上运行example.com/flower

在flower的github repo的master分支中,作者已经恢复--url-prefix参数(12天前,所以还没有在pypi上,所以pip install flower会拉老版本),看到这个问题(问题是我报告的)。

所以你需要做的是从github repo的master分支而不是pypi安装flower,并--url-prefix=flower在运行flower时在命令行中指定。

于 2016-03-10T07:59:33.133 回答