[英]Django one database for each application in the same project
I have a Django project that contains two applications App1 and App2 我有一个Django项目,其中包含两个应用程序App1和App2
I have configured two databases DB1 and DB2
我已经配置了两个数据库DB1 and DB2
when I use python manage.py syncdb
the tables corresponding to model of the two application are created in the first database 当我使用python manage.py syncdb
,在第一个数据库中创建与两个应用程序的模型相对应的表
How can I configure Django to make the model of the first application goes to the first database and the model of the second application goes to the second database 如何配置Django,以使第一个应用程序的模型转到第一个数据库,而第二个应用程序的模型转到第二个数据库
您需要实现自动数据库路由 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.