芹菜和奥斯陆配置不能一起工作

2024-04-24 21:56:17 发布

您现在位置:Python中文网/ 问答频道 /正文

初始化的最佳方法是什么奥斯陆.cfg在芹菜项目中?在

我想这样做:

from phantom.openstack.common import cfg

import os

possible_topdir = os.path.normpath(os.path.join(os.path.abspath(__file__),
                                   os.pardir, os.pardir))
conf_file = os.path.join(possible_topdir, 'etc/phantom', 'phantom.conf')
print 'config done 1'
config_files = None
if os.path.exists(conf_file):
    config_files = [conf_file]
print 'config done 2'
cfg.CONF(project='phantom', default_config_files=[conf_file])

我有一个配置文件,其中存储了一组url和用户权限,在不同的任务执行过程中,我将使用它们访问不同的系统。在

我试着在我的芹菜.py我现在有这个

^{pr2}$

如果我把它插入这个块,它会返回一个错误,说:

LM-SJN-00871893:Phantom uruddarraju$ celery -A phantom.celery.celery worker -l DEBUG

usage: celery [-h] [--version] [--config-file PATH] [--config-dir DIR]
celery: error: unrecognized arguments: -A phantom.celery.celery worker -l DEBUG

Tags: pathimportconfigosconffilescfgfile