繁体   English   中英

django 的官方 celery 项目不起作用

[英]Official celery project for django is not working

我正在使用 django 的官方 celery 项目,但它在我的机器上不起作用。

我已经安装了所有必要的模块,并且正在使用链接中给出的示例: Example Django project using Celery

我已经搜索过相同的错误并使用了一些解决方案,但没有解决方案可以解决我的问题。 当我使用命令: celery -A proj worker -l INFO时,我得到以下响应:

--- ***** -----
-- ******* ---- Windows-10-10.0.22000-SP0 2022-05-16 14:19:39
- *** --- * ---
- ** ---------- [config]
- ** ---------- .> app:         proj:0x230fa67a6a0
- ** ---------- .> transport:   amqp://guest:**@localhost:5672//
- ** ---------- .> results:
- *** --- * --- .> concurrency: 4 (prefork)
-- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
--- ***** -----
 -------------- [queues]
                .> celery           exchange=celery(direct) key=celery


[tasks]
  . demoapp.tasks.add
  . demoapp.tasks.count_widgets
  . demoapp.tasks.mul
  . demoapp.tasks.rename_widget
  . demoapp.tasks.xsum
  . proj.celery.debug_task

[2022-05-16 14:19:40,464: INFO/SpawnPoolWorker-4] child process 7240 calling self.run()
[2022-05-16 14:19:40,481: INFO/SpawnPoolWorker-3] child process 6960 calling self.run()
[2022-05-16 14:19:40,493: INFO/SpawnPoolWorker-2] child process 10964 calling self.run()
[2022-05-16 14:19:40,516: INFO/SpawnPoolWorker-1] child process 6272 calling self.run()
[2022-05-16 14:19:41,978: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [WinError 10061]```

As I said I am using the source code itself, can anyone tell me how I can solve this problem?

芹菜不支持 Windows

但是您可以使用 eventlet 在 Win 上运行它,如此所述

此外,请确保您已在本地安装RabbitMQ并且它在端口 5672 中运行。此外,您需要在settings.py中指定 amqp 服务器的凭据

从你的指南

设置文件假定 rabbitmq-server 使用默认端口在 localhost 上运行。

此外,您可以将 amqp 服务器作为 docker 容器运行。 它可能比在本地安装更容易:

docker run -d -p 5672:5672 -p 15672:15672 rabbitmq:3-management

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM