【发布时间】:2020-03-13 01:50:25
【问题描述】:
minimal django/celery/redis 在本地运行,但是当我在 python 上运行时,部署到 heroku 时出现以下错误:
raise ConnectionError(self._error_message(e))
kombu.exceptions.OperationalError: Error 111 connecting to localhost:6379. Connection
refused.
这是我的应用程序目录中的 tasks.py 文件:
from celery import Celery
import os
app = Celery('tasks', broker='redis://localhost:6379/0')
app.conf.update(BROKER_URL=os.environ['REDIS_URL'],
CELERY_RESULT_BACKEND=os.environ['REDIS_URL'])
@app.task
def add(x, y):
return x + y
Requirements.txt:
django
gunicorn
django-heroku
celery
redis
celery-with-redis
django-celery
kombu
我已将 worker dyno 设置为 1。 有趣的是我可以发誓它以前可以工作,现在由于某种原因它不起作用。
【问题讨论】:
标签: django heroku redis celery