问题
celery不能用root用户启动问题 C_FORCE_ROOT environment
如果使用root用户启动celery会遇到下面的问题
python manage.py celery worker -c 4
System check identified some issues:
WARNINGS:
back_manage.Account.organization: (fields.W340) null has no effect on ManyToManyField.
back_manage.Account.st_post: (fields.W340) null has no effect on ManyToManyField.
back_manage.Crop.stage: (fields.W340) null has no effect on ManyToManyField.
back_manage.DevelopmentStage.grade: (fields.W340) null has no effect on ManyToManyField.
back_manage.OrganizationStrut.ws: (fields.W340) null has no effect on ManyToManyField.
back_manage.Post.menu: (fields.W340) null has no effect on ManyToManyField.
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).
User information: uid=0 euid=0 gid=0 egid=0
执行
export C_FORCE_ROOT=True
重新执行
python manage.py celery worker -c 4
System check identified some issues:
WARNINGS:
back_manage.Account.organization: (fields.W340) null has no effect on ManyToManyField.
back_manage.Account.st_post: (fields.W340) null has no effect on ManyToManyField.
back_manage.Crop.stage: (fields.W340) null has no effect on ManyToManyField.
back_manage.DevelopmentStage.grade: (fields.W340) null has no effect on ManyToManyField.
back_manage.OrganizationStrut.ws: (fields.W340) null has no effect on ManyToManyField.
back_manage.Post.menu: (fields.W340) null has no effect on ManyToManyField.
-------------- celery@iZ8vbaeuxvbzsvnyblfbctZ v3.1.26.post2 (Cipater)
---- **** -----
--- * *** * -- Linux-4.4.0-142-generic-x86_64-with-Ubuntu-16.04-xenial
-- * - **** ---
- ** ---------- [config]
- ** ---------- .> app: lot_case_demo:0x7fe250def190
- ** ---------- .> transport: redis://:**@xxxxxxxxxxxxxxxxxxx/xx
- ** ---------- .> results:
- *** --- * --- .> concurrency: 4 (prefork)
-- ******* ----
--- ***** ----- [queues]
-------------- .> celery exchange=celery(direct) key=celery