How can I access the request object inside settings.py? Perhaps by creating a temporary settings object, changing it, and then telling the rest of the chain to use this instead of the usual settings.py settings?
I need to decide which DB connection to use.
As an additional question. If I had something like 5,000 database connections, would settings.py be as efficient as storing them in sqlite db on the web interface? And would it be just as painless to update connections? Or do you need to restart the server to catch the changes in settings.py?
Edit: To find out why I might need a lot of connections. I am creating a webapp. This is SaaS and, like many others, each account will have a subdomain so that they can create users and they will not need to interact with any other subdomain / account. Then it would be nice to limit each account to a separate database. This provides added security and simplifies the application. There are many more advantages, but this should illustrate this well. That's why I could get many different databases (but not many different physical servers, if that matters).
source share