task_id=my_task. Delay (my_model. Id)
In the task for the following operations:
@ app. Task
Def my_task (id) :
The file=my_model. Objects. The get (id=id)
But will quote us the following error:
django. Db. Utils. DatabaseError: DatabaseWrapper objects created in a thread can only be 2 in that same thread. The object with The alias' default 'was created in 2662856759904 and this is The thread id thread id 2660784454544.
Look mean in one thread to create the object cannot be used to other threads, and don't know if I use in the right way, you have fall over the same questions? Everyone is how to solve?
CodePudding user response:
I get a preliminary solution, reference to you, hope each master can help me to find a final solutionhttps://blog.csdn.net/mike198300/article/details/105612288