django.db.utils.DatabaseError 单独启动个脚本调用django的orm报错
来源:7-10 有没有方法既可以使用外键又不定死外键类型?

慕的地7158155
2022-03-11
我单独使用一个脚本去启动django的orm,结果报错了。
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 17060 and this is thread id 2609190477672.
写回答
1回答
-
bobby
2024-12-27
不能单独启动某个文件, orm没法初始化,想要单独启动 需要调用 django的setup
00
相似问题