芹菜会默认拒绝泡菜,我应该禁用它吗?

2024-10-01 15:29:27 发布

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

我刚刚设置了我的第一个芹菜实例,出于安全考虑,我收到了禁用pickle作为序列化程序的警告。关掉它的后果是什么?芹菜需要连续器干什么?

If you depend on pickle then you should set a setting to disable this warning and to be sure that everything will continue working when you upgrade to Celery 3.2::

CELERY_ACCEPT_CONTENT = ['pickle', 'json', 'msgpack', 'yaml']


Tags: to实例程序you警告if序列化on
1条回答
网友
1楼 · 发布于 2024-10-01 15:29:27

来自http://celery.readthedocs.org/en/latest/faq.html#is-celery-dependent-on-pickle

The default serialization format is pickle simply because it is convenient (it supports sending complex Python objects as task arguments).

无论是否使用pickle,您都可能希望通过设置CELERY_ACCEPT_CONTENT配置变量来关闭此警告。

如果在任务中不使用Python对象作为参数,则应考虑使用安全的,例如json序列化格式。

pickle的另一个限制是没有任务结果-请参见http://docs.celeryproject.org/en/latest/faq.html#isn-t-using-pickle-a-security-concern

For the task messages you can set the CELERY_TASK_SERIALIZER setting to “json” or “yaml” instead of pickle. There is currently no alternative solution for task results (but writing a custom result backend using JSON is a simple task)

相关问题 更多 >

    热门问题