
Django multiple database support - now supports multiple database connections
All Twitter is literally boiling from this news - django now supports multiple database connections. The feature is poured into the trunk and is described in the documentation .
The documentation (the link above) describes the process of setting up and using several databases in the django:
# in settings.py: # in model lookups: # using ('default') - an explicit indication of the database for the query. If you do not specify default will be taken. For more details, see the documentation! Congratulations to all on this new feature, we have been waiting for such functionality for a long time. Hurrah!
The documentation (the link above) describes the process of setting up and using several databases in the django:
# in settings.py: # in model lookups: # using ('default') - an explicit indication of the database for the query. If you do not specify default will be taken. For more details, see the documentation! Congratulations to all on this new feature, we have been waiting for such functionality for a long time. Hurrah!
DATABASES = {
'default': {
'NAME': 'app_data',
'BACKEND': 'django.db.backends.postgres_psycopg2',
'USER': 'postgres_user',
'PASSWORD': 's3krit'
},
'users': {
'NAME': 'user_data'
'BACKEND': 'django.db.backends.mysql',
'USER': 'mysql_user',
'PASSWORD': 'priv4te'
}
}
Author.objects.using('default').all()