In Django when using multiple DB's how to map databases, for ex: from request there is a parameter as app1 which maps to db1 and another request app2 mapping to db2. Now how to choose db's much before sending the request to views
DATABASE_APPS_MAPPING = {'app1':'db1','app2':'db2'}
DATABASES = {
'default': {
},
'db1': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'hp1',
'USER': 'server',
'PASSWORD': 'hpdata',
'HOST': '192.168.3.11',
'PORT': '3306'
},
'db2': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'hp2',
'USER': 'server',
'PASSWORD': 'hpdata',
'HOST': '192.168.3.11',
'PORT': '3306'
}
}