"module not found" 当 运行 芹菜与主管

"module not found" when running Celery with supervisor

我正在尝试 运行 使用主管的 django 芹菜。

supervisor_celery.conf

[program:supervisor-celery]
command=/home/user/project/virtualenvironment/bin/celery worker -A project --loglevel=INFO
directory=/home/user/project/project
user=nobody
numprocs=1
stdout_logfile=/home/user/project/logs/celery.log
stderr_logfile=/home/user/project/logs/celery.log
autostart=true
autorestart=true
startsecs=10
stopwaitsecs = 600
stopasgroup=true
priority=1000

在 运行ing 主管上,我在日志文件中收到以下错误:-

Unable to load celery application.
The module project was not found.

项目结构是

project
|-project
   |-settings
       |-production.py
   |-__init__.py
   |-celery.py
   |-urls.py
   |-wsgi.py
|-app

__init__.py的内容是:-

from __future__ import absolute_import, unicode_literals
from .celery import app as celery_app
__all__ = ('celery_app',)

celery.py的内容是

from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings.production')
app = Celery('project')
app.config_from_object('django.conf:settings', namespace='CELERY')
app.autodiscover_tasks()

如果有人能告诉我它为什么不起作用,我会很有帮助吗?

看来你的目录不对(supervisor conf),应该是

directory=/home/user/project