i have one multi tenant project in which i am creating multiple tenants . and myy each tenant is creating new schema . now i want to write one script in which will read each request and in each request i will pass tenant_identifier and i want my django application to connect to that database. is it possible and if yes then how should i do that?
See the docs for Multiple Databases.
Note: There are some limits to this. Also, you’ll want to evaluate the middleware you’re using to determine whether it needs to be modified to support what you’re trying to do.
Have you seen django-tenants? I believe it is designed for exactly this use case.
yes i saw that but what i want to do is … i don’t want to switch my db on domain name … i want to switch db based on the given tenant-identifier in the request.