启动后Celerybeat立即关闭

sba*_*ler 5 django-celery celeryd celerybeat

我有一个使用celeryd和celerybeat的django应用程序。两者都设置为作为守护程序运行。celerybeat任务无法执行,因为celerybeat无法正确启动。根据日志,它将立即关闭:

[2012-05-04 13:02:49,055: WARNING/MainProcess] celerybeat v2.5.1 is starting.
[2012-05-04 13:02:49,122: INFO/MainProcess] process shutting down
[2012-05-04 13:02:49,122: DEBUG/MainProcess] running all "atexit" finalizers with priority >= 0
[2012-05-04 13:02:49,134: DEBUG/MainProcess] running the remaining "atexit" finalizers
Run Code Online (Sandbox Code Playgroud)

我从/etc/int.d/celerybeat start开始

这是/ etc / default / celerybeat配置:

# Where the Django project is.
CELERYBEAT_CHDIR="/var/www/path_to_app/cms/"

# Python interpreter from environment.
ENV_PYTHON="$CELERYBEAT_CHDIR/bin/python"

# Name of the projects settings module.
export DJANGO_SETTINGS_MODULE="cms.settings"

# Path to celerybeat
CELERYBEAT="$ENV_PYTHON $CELERYBEAT_CHDIR/cms/manage.py celerybeat"

# Extra arguments to celerybeat
CELERYBEAT_LOG_LEVEL="DEBUG"
CELERYBEAT_USER="www-data"

CELERYBEAT_GROUP="www-data"
Run Code Online (Sandbox Code Playgroud)

任务计划在settings.py中设置:

CELERYBEAT_SCHEDULE = {
    # Executes every  morning at 7:00 A.M
    "every-morning": {
        "task": "cms.tasks.get_recent_posts_for_all_pages",
        "schedule": crontab(hour=7, minute=00)
    },
}
Run Code Online (Sandbox Code Playgroud)

当我使用./manage.py celerybeat从shell运行celerybeat时,它似乎运行良好。

celeryd配置中也有一个celerybeat部分,但我假设忽略了这一部分。

问候西蒙