Django with Regional Databases and Users
I'm looking to provide reliable uptime with a horizontally scaled Django service. I want to run migrations on a somewhat timezone based schedule such that migrations are run when the fewest users are online. Those users have static locations, so we can reliably assign them to regions.
For this, I was thinking I would have separate databases depending on region. eu_east
, eu_west
, etc and using a database router to keep users and their data separate.
The challenge is, I don't want users to have to enter the region they're in every time they authenticate. I want them to just enter username and password, and have the regional aspect of the site be transparent to them. I'm imagining some sort of user->region default database lookup, but I was wondering if there was a best-practice for this use case, or something I'm not considering?