报错: 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 ****and this is thread id *****.
使用的是 nginx+uwsgi+django+mysql
问题出在uwsgi配置上,使用了协程
原配置文件关于协程的配置是:
gevent = 20 gevent-monkey-patch = true
加一条 gevent-early-monkey-patch = true 就好了:
gevent = 20 gevent-monkey-patch = true gevent-early-monkey-patch = true