Django TestCase not using transactions on secondary database

前端 未结 2 1196
梦毁少年i
梦毁少年i 2021-01-05 03:20

I am using Django 1.3.1. I have two databases, some of my models live in one database, some in the other. Both databases are contrib.gis.db.backends.postgis databases.

相关标签:
2条回答
  • 2021-01-05 04:01

    Note that multi_db is deprecated since Django 2.2.
    The new option to use is databases.

    0 讨论(0)
  • 2021-01-05 04:18

    Try this:

    class MyTestCase(TestCase):
        multi_db = True
    

    https://docs.djangoproject.com/en/1.2/topics/testing/#django.test.TestCase.multi_db

    0 讨论(0)
提交回复
热议问题