python - django celery 击败 DBAccessError

标签 python celery django-celery

我正在用 celerybeat 运行 django+celery,但出现了这个错误

.../local/lib/python2.7/site-packages/celery/beat.py", line 367, in setup_schedule
    writeback=True)
  File "/usr/lib/python2.7/shelve.py", line 239, in open
    return DbfilenameShelf(filename, flag, protocol, writeback)
  File "/usr/lib/python2.7/shelve.py", line 223, in __init__
    Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback)
  File "/usr/lib/python2.7/anydbm.py", line 85, in open
    return mod.open(file, flag, mode)
  File "/usr/lib/python2.7/dbhash.py", line 18, in open
    return bsddb.hashopen(file, flag, mode)
  File "/usr/lib/python2.7/bsddb/__init__.py", line 364, in hashopen
    d.open(file, db.DB_HASH, flags, mode)
DBAccessError: (13, 'Permission denied')
[2014-11-05 06:39:20,901: INFO/MainProcess] mingle: all alone

我使用 python manage.py celeryd -B 来运行 celery beat。 似乎运行 celery worker 不是问题,但是 celerybeat worker 没有初始化。关于在哪里可以找到 celery 试图访问的数据库有什么建议吗?

我正在运行 django=1.5 和 django-celery==3.1.10

最佳答案

我问得太早了!

回答我自己的问题,以防其他人遇到同样的问题。

问题是因为我在我的 django 项目运行的文件夹中没有写权限。

来自文档 ( http://celery.readthedocs.org/en/latest/userguide/periodic-tasks.html#starting-the-scheduler )

Beat needs to store the last run times of the tasks in a local database file (named celerybeat-schedule by default), so it needs access to write in the current directory

通过运行解决了问题

python manage.py celeryd -B -s /path/to/where/i/have/write-access/celerybeat-schedule

希望这对某人有帮助。

关于python - django celery 击败 DBAccessError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26756166/

相关文章:

Django 和 celery : Tasks not imported

django - 如何使用 TTL 设置 Celery,以便从队列中清除旧消息?

django - 在 Django Celery 中使用 .env 中的环境变量

python - celery 错误 : "ModuleNotFoundError: No module named ' tasks'"

django - Celery + Django 信号

python - 如何为django应用程序设置图片上传根目录

python - 如何使用 python-xlsxwriter 从 excel 文件的单元格中删除绿色箭头?

django - 主管启动 celery worker,生成它并以状态码退出(退出状态 1;不是预期的)

python - 字符串格式为 base64 到 base64 对象

python - 将变量插入Python和CoffeeScript中的字符串