关于celery的bug解决方法:AttributeError: module 'celery_tasks' has no attribute 'celery'

最近写代码突然出现了关于celery属性出错的问题,在网上查了很久也没有找到解决方法,后来重新检查代码才发现是代码的写错误了。

Bug截图

AttributeError: module 'celery_tasks' has no attribute 'celery'

解决方法

  • 检查代码是否出错:
    错误代码:celery -A celery_tasks worker -l info
    正确代码:celery -A celery_tasks.main worker -l info'
    分析:celery属性是在main文件中,只有执行了main文件才能找到celery属性
    在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_43162402/article/details/83314692