South error when working with multiple databases: django.db.utils.ConnectionDoesNotExist: The connection foo doesn't exist

django, django-south

Solution

The database syncing method does not take the NAME key in the --database option. As specified earlier, default for your db1 only works. So you need to setup an additional database dictionary for your db2.

Problem

I have 2 Django projects with following db settings: ``` DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'db1', # 'db2' for second db ... } } ``` When trying to sync second db with command python manage.py syncdb --database=db2 I receive error django.db.utils.ConnectionDoesNotExist: The connection db2 doesn't exist When I use some other commands, South uses migrations from first project and fills db2 with wrong tables. How to correctly sync/migrate several projects served by single Django + South instance?

Original source