tags:

views:

29

answers:

1

I have a Django project that contains two applications App1 and App2

I have configured two databases DB1 and DB2

when I use python manage.py syncdb the tables corresponding to model of the two application are created in the first database

How can I configure Django to make the model of the first application goes to the first database and the model of the second application goes to the second database

+1  A: 

You need to implement Automatic database routing.

Lakshman Prasad
I have two application core and nagiosI need the model of the core app to be presisted in the default database while the model of the nagios app map the nagios database I implemented database routing as followin setting.py:DATABASE_ROUTERS = [ 'emonitor.routers.NagiosRouter',]in routers.py:I defined a class called NagiosRouter and it contains this function def allow_syncdb(self, db, model): if db == 'nagios': return False else: return Nonewhen I apply syncdb I get tables for each nagios class in the default database.what is wrong here ?
Fanooos