执行异步任务时报错:

django.db.utils.DatabaseError: DatabaseWrapper objects created in a thread can only be used in that same thread. The object with alias 'default' was created in thread id 2068603070080 and this is thread id 2069065236128.

解决方法:

原先启动命令:

celery -A xxx worker -l info -P eventlet

替换为:
celery -A xxx  worker -l info  --pool=solo

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐