芹菜在虚拟环境中与主管



supervisor install in Linux Ubuntu with python2.7

virtualenv:python3.6 + Django2.0 + celery4.2

这是 celery.py 文件:

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

初始化文件 :

from __future__ import absolute_import, unicode_literals
from .celery import app as celery_app
__all__ = ['celery_app']

我在当地的芹菜工人很好,但是当我与主管虚拟运行芹菜时:

File "/path/env/mysite/mysite/__init__.py", line 5, in <module>
from .celery import app as celery_app
File "/path/env/mysite/mysite/celery.py", line 7, in <module>
app.config_from_object('django.conf:settings', namespace='CELERY')
TypeError: config_from_object() got an unexpected keyword argument 'namespace'

我的芹菜工人设置:

[program:celery.worker] 
directory=/path/env/mysite/
command=/path/env/mysite/celery -A mysite worker -l info
user=root
numprocs=1          
autostart=true      
autorestart=true    
stopsignal=INT
stdout_logfile=/path/env/mysite/celery_worker.log 
stdout_logfile_maxbytes=10MB  
stdout_logfile_backups=10     
redirect_stderr=false         
stderr_logfile=/path/env/mysite/celery_worker_err.log 
stderr_logfile_maxbytes=10MB 
stderr_logfile_backups=10

我试过了:

1.环境

environment=PATH="/path/env/bin",VIRTUAL_ENV="/path/env/mysite/",PYTHONPATH="/path/env/lib/python:/path/env/lib/python3.6/site-packages"

2.命令full_path

command=/path/env/mysite/celery -A mysite worker -l info

主管>状态

supervisor> status
celery.work                      BACKOFF   can't find command '/path/env/mysite/celery'

我这样引用别人的路径:

command=/path/env/mysite/bin/celery -A mysite worker -l info

但我的项目没有"bin"目录

我试过了:

command=/path/env/bin/celery -A mysite worker -l info

错误:

ModuleNotFoundError: No module named 'mysite'

此问题是将芹菜 4.2 与主管一起使用

我通过使用芹菜解决了问题 3.1.16

相关内容

  • 没有找到相关文章

最新更新