這裏是我的芹菜應用程序配置:Django的芹菜守護程序不起作用
from __future__ import absolute_import
from celery import Celery
import os
from django.conf import settings
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tshirtmafia.settings')
app = Celery('tshirtmafia')
app.conf.update(
CELERY_RESULT_BACKEND='djcelery.backends.database:DatabaseBackend',
)
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
settings.py:
INSTALLED_APPS:
'kombu.transport.django',
'djcelery',
也:
BROKER_URL = 'django://'
這裏的我的任務:
@shared_task
def test():
send_mail('nesamone bus', 'Files have been successfully generated.', '[email protected]',
['[email protected]'], fail_silently=False)
現在,我在本地運行本地python manage.py celeryd
,然後從本地運行test.delay(),它可以工作。
現在我試圖部署我的應用程序。當使用完全相同的配置時,我嘗試打開python manage.py celeryd,並在其他窗口中打開shell並運行測試任務,但它不起作用。
我也試着設置後臺守護進程是這樣的:
的/ etc /默認/ celeryd配置:
# Name of nodes to start, here we have a single node
CELERYD_NODES="w1"
# or we could have three nodes:
#CELERYD_NODES="w1 w2 w3"
# Where to chdir at start. (CATMAID Django project dir.)
CELERYD_CHDIR="/home/tshirtnation/"
# Python interpreter from environment. (in CATMAID Django dir)
ENV_PYTHON="/usr/bin/python"
# How to call "manage.py celeryd_multi"
CELERYD_MULTI="$ENV_PYTHON $CELERYD_CHDIR/manage.py celeryd_multi"
# How to call "manage.py celeryctl"
CELERYCTL="$ENV_PYTHON $CELERYD_CHDIR/manage.py celeryctl"
# Extra arguments to celeryd
CELERYD_OPTS="--time-limit=300 --concurrency=1"
# Name of the celery config module.
CELERY_CONFIG_MODULE="celeryconfig"
# %n will be replaced with the nodename.
CELERYD_LOG_FILE="/var/log/celery/%n.log"
CELERYD_PID_FILE="/var/run/celery/%n.pid"
# Workers should run as an unprivileged user.
CELERYD_USER="celery"
CELERYD_GROUP="celery"
# Name of the projects settings module.
export DJANGO_SETTINGS_MODULE="settings"
我使用默認的芹菜/etc/init.d/celeryd腳本。
所以基本上它看起來像芹菜開始,但不起作用。不知道如何調試,可能是錯誤的。
讓我知道,如果你有什麼事
你可以在'/ var/log/celery * .log'上發佈你的日誌文件嗎? – ChillarAnand 2014-09-30 10:51:59