Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/355.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 芹菜服务器错误:“;不能将新设置名称与旧设置名称混合使用”;_Python_Celery - Fatal编程技术网

Python 芹菜服务器错误:“;不能将新设置名称与旧设置名称混合使用”;

Python 芹菜服务器错误:“;不能将新设置名称与旧设置名称混合使用”;,python,celery,Python,Celery,我使用芹菜服务器和redis作为代理和烧瓶 flask服务器运行后,我启动芹菜工人(通过cellery-E-A app.cellery worker),但出现以下错误: Process SpawnPoolWorker-115: Traceback (most recent call last): File "c:\users\a\appdata\local\programs\python\python36\lib\site-packages\kombu\utils\objects.py

我使用芹菜服务器和redis作为代理和烧瓶

flask服务器运行后,我启动芹菜工人(通过
cellery-E-A app.cellery worker
),但出现以下错误:

Process SpawnPoolWorker-115:
Traceback (most recent call last):
  File "c:\users\a\appdata\local\programs\python\python36\lib\site-packages\kombu\utils\objects.py
    return obj.__dict__[self.__name__]
KeyError: 'default_modules'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\a\appdata\local\programs\python\python36\lib\site-packages\kombu\utils\objects.py
    return obj.__dict__[self.__name__]
KeyError: 'data'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\a\appdata\local\programs\python\python36\lib\site-packages\billiard\process.py",
    self.run()       [.....]
  File "c:\users\a\appdata\local\programs\python\python36\lib\site-packages\celery\app\utils.py",
    for key in sorted(really_left)
celery.exceptions.ImproperlyConfigured:

Cannot mix new setting names with old setting names, please
rename the following settings to use the old format:

include                              -> CELERY_INCLUDE

Or change all of the settings to use the new format :)
但是我没有使用设置名称
include
cellery\u include

celery = Celery(
    imports=app.import_name,
    result_backend=app.config['CELERY_RESULT_BACKEND'],
    broker_url=app.config['BROKER_URL']
)
此错误可能来自何处?

如果按照 让舒尔在功能
Make_芹菜(app)
中删除
cellery.conf.update(app.config)

该错误将不再显示。

当您使用以下两种方法更新芹菜配置时,此错误会加剧

一,

celery.conf.update()

二,

celery.conf.task_路径={
'taskname':{'queue':'celery'}
}

只走一条路

最佳做法是将所有配置保存在celeryconfig.py文件中,并在celery应用程序中导入

示例celeryconfig.py

app.py

希望这能解决你的问题

签出新的小写设置以新格式写入配置

broker_url = 'redis://localhost:6379/0'
result_backend = 'redis://localhost:6379/0'

task_serializer = 'json'
result_serializer = 'json'
accept_content = ['json']
timezone = 'Asia/Kolkata'
enable_utc = True
import celeryconfig

celery = Celery()
celery.config_from_object(celeryconfig)