【发布时间】:2021-11-20 12:14:10
【问题描述】:
我正在尝试运行 celery,即使我正确设置了用户、虚拟主机并分配了适当的标签,它也无法连接到 RabbitMQ 服务器
celery -A proj worker -l info
以上命令返回错误
[2021-09-28 18:05:37,649: ERROR/MainProcess] consumer: Cannot connect to amqp://test:**@12:5672//: timed out.
Trying again in 2.00 seconds... (1/100)
我已经按如下方式初始化了 celery 应用程序
app = Celery('proj',
broker=f'amqp://test:test@12#4@localhost/test_vhost')
我认为这不起作用,因为密码 test@12#4 中包含特殊字符 @ 和 #。
如何在不更改密码的情况下使其工作。
【问题讨论】:
-
也许能逃脱
@? -
试试
app = Celery('proj', broker=fr'amqp://test:test@12#4@localhost/test_vhost')或app = Celery('proj', broker=r'amqp://test:test@12#4@localhost/test_vhost') -
@Superbman 您的建议无效
-
@C.Nivs 你能提供
@的转义吗,我找不到。我为#找到的,它是%23 -
当我用
%23替换#时它起作用了,我猜是#导致字符串终止并导致问题,而不是@。 @C.Nivs,已经用你的建议解决了,所以如果你写了一个答案,我会把它标记为这个问题的正确答案
标签: python django rabbitmq celery django-celery