Background: I have 5 independent Django projects which I am attempting to combine in to 1 Django project composed of several apps. In other words: projA has appA, projB has appB & projC has appC, etc. I want 1 masterProj that has appA, appB & appC.
Currently each app connects to it's own independent database (the apps don't share data). Each project uses Django user authentication, Django registration, taggit, profiles, comments and sorl-thumbnail.
I'm using Django 1.4 and setup database routing according to this stackoverflow answer so that, once combined into one project, each app in the newly combined Django project is still able to connect to its own database. That went smoothly, but I started running into trouble with things like user authentication and taggit:
1) As mentioned before, each app connects to a different database and each of those databases has a table named 'auth_user'. However, I've found that all read/write calls to the auth_user table (regardless of which app makes the read/write call) are routed to the default database (in this case appA's database):
# settings.py:
DATABASES['default'] = DATABASES['appA']
DATABASE_ROUTERS = ['appA.db.DBRouter', 'appB.db.DBRouter', 'appC.db.DBRouter']
# appA/dbrouterA.py (appB, appC routers are identical this, replacing 'appA' with 'appB', etc.)
class DBRouter(object):
def db_for_read(self, model, **hints):
if model._meta.app_label == 'appA':
return 'appA'
if model._meta.app_label == 'auth':
return 'appA'
return None
def db_for_write(self, model, **hints):
if model._meta.app_label == 'appA':
return 'appA'
if model._meta.app_label == 'auth':
return 'appA'
return None
2) Assuming I get the ro