芹菜花找不到js文件

Celery Flower not found js files

刚开始用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 是 运行 normallu,这是来自日志文件的消息

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

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

github repo of flower, its author has restored the --url-prefix parameter (12 days ago, so it is not on pypi yet, so pip install flower will pull older version), see this issue 的主分支中(问题由我报告)。

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