Django3+celery4.4报错DatabaseWrapper objects created in a thread can only be used in that same thread.

执行异步任务时报错:

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

你可能感兴趣的:(Django,celery,django,python)