South error when working with multiple databases: django.db.utils.ConnectionDoesNotExist: foo connection does not exist

I have 2 Django projects with the following db settings:

DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'db1', # 'db2' for second db ... } } 

When trying to synchronize the second db with the command

python manage.py syncdb --database = db2

I get an error

django.db.utils.ConnectionDoesNotExist: db2 connection does not exist

When I use some other commands, the South uses migrations from the first project and populates db2 with the wrong tables. How to properly synchronize / transfer multiple projects served by a single instance of Django + South?

+4
source share
1 answer

The database synchronization method does not accept the NAME key in the - database . As stated earlier, the default for db1 only works. Therefore, you need to configure an additional database dictionary for db2 .

+5
source

Source: https://habr.com/ru/post/1446848/


All Articles