在 SourceLair 上配置 Celery

Configuring Celery on SourceLair

目标

我在云端有一个 Django 项目 IDE (SourceLair)。在 a guide 之后,我正在尝试将 Celery 配置为我的应用程序的一部分。

代码

settings.py

CELERY_BROKER_URL = 'amqp://localhost'

错误

[2018-08-22 16:03:43,059: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 111] Connection refused.
Trying again in 2.00 seconds...

大多数情况下您没有提及 RabbitMQ 所在的端口 运行。

能否尝试在 settings.py 文件 CELERY_BROKER_URL 中修改为这个

CELERY_BROKER_URL = 'amqp://guest:guest@localhost:5672/'

从 SourceLair 支持,我了解到问题是 SourceLair 不支持 RabbitMQ。相反,我已经使用 SQS 成功配置了 Celery。

完整消息:

The reason this is not working is because the CELERY_BROKER_URL you provided is using RabbitMQ as the underlying message queue. RabbitMQ cannot be used on SourceLair at all, but there are a couple of alternatives for you:

You can use the Redis Broker via SourceLair's Redis add-on (currently in private mode, for per month after 1 week of free trial) You can use Amazon SQS which has a free tier available