Created
April 12, 2011 12:46
-
-
Save felipe-prenholato/915438 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
from ldapdb.router import is_ldap_model, Router as _Router | |
class Router(object): | |
def db_for_read(self, model, **hints): | |
if is_ldap_model(model): | |
return 'ldap_gold' | |
return None | |
def db_for_write(self, model, **hints): | |
if is_ldap_model(model): | |
return 'ldap_gold' | |
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DATABASES = { | |
'default': { | |
'ENGINE': 'mysql', | |
'NAME': 'sisweb', | |
'USER': 'pdgsisweb', | |
'PASSWORD': 'pdgsisweb#2010', | |
'HOST': '', | |
'PORT': '', | |
}, | |
'ldap_pdgr': { | |
'ENGINE': 'ldapdb.backends.ldap', | |
'NAME': "ldap://server1.pdgr.corp", | |
'USER': "[email protected]", | |
'PASSWORD': "passwd", | |
}, | |
'ldap_gold': { | |
'ENGINE': 'ldapdb.backends.ldap', | |
'NAME': "ldap://sever2.goldfarb.corp", | |
'USER': "[email protected]", | |
'PASSWORD': "passwd", | |
}, | |
'ldap_chl': { | |
'ENGINE': 'ldapdb.backends.ldap', | |
'NAME': "ldap://server3.chl.corp", | |
'USER': "[email protected]", | |
'PASSWORD': "passwd", | |
}, | |
} | |
DATABASE_ROUTERS = ['ldap_connector.Router'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment