celery不能root用户启动解决(C_FORCE_ROOT environment)

celery不能root用户启动解决(C_FORCE_ROOT environment)

 

 

Running a worker with superuser privileges when the
worker accepts messages serialized with pickle is a very bad idea!

If you really want to continue then you have to set the C_FORCE_ROOT
environment variable (but please think about this before you do).

解决方法

from celery import Celery, platforms

app = Celery('tasks', broker='amqp://myuser:

mypassword@localhost :5672/vhost')

platforms.C_FORCE_ROOT = True #加上这一行

@app.task
def add(x, y):
return x + y

添加:

platforms.C_FORCE_ROOT = True #加上这一行即可

 

posted on 2023-04-08 09:23  一先生94  阅读(206)  评论(0编辑  收藏  举报

导航