celery 报错 RuntimeError: 'path' m

2019-07-24  本文已影响0人  Jayce_xi

1. 问题描述

在merge完代码后,发现服务起不来了。错误报的是:

RuntimeError: 'path' must be None or a list, not <class '_frozen_importlib_external._NamespacePath'>

2.问题分析

完全没遇到过发,直接google,发现第一个的答案完全不太一样,在第二个中发现一个好的回答:

This error will occur when use autodiscover_task in celery and one of these app's folder did't have init.py file
pretty hard to find out what is going on.. debug information is lack

原因就是celery中autodiscover_task会去扫描每一个注册的app底下的__init__.py文件,恰好,merge的代码里面有一个app没有这个文件。这中情况是极少发生的。

3. 问题解决

在没有__init__.py的app中添加__init__.py

4.参考解答

github/celery/issues/2523

上一篇 下一篇

猜你喜欢

热点阅读