Question:
How can I add multiple databases for testing in Django?
When I ran my test suits I got this Error:
AssertionError: Database queries to 'mig' are not allowed in this test. Add 'mig' to path_to_test_suit.MigrationServiceTest.databases to ensure proper test isolation and silence this failure.
Here are my PostgreSQL settings:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'db_1_name',
'USER': 'db_1_user',
'PASSWORD': 'db_1_passwd',
'HOST': 'db_1_host',
'PORT': 'db_1_port',
},
'mig': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': db_2_name,
'USER': db_2_user,
'PASSWORD': 'db_2_passwd',
'HOST': 'db_2_host',
'PORT': 'db_2_port',
},
}
I use
Django-nosefor running test suits and useDjango 2.2