--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CANGESS-w7ctv9AeGkbBymuhLgYAdEZqcDSrkwPCd3Rw8-6Rkjw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Yes, it should be quite straightforward to implement.
Setup the appropriate databases, say, db_asia, db_euro, etc. Create separate apps asia, euro, etc. Create a db_router that makes asia models sticky to db_asia, etc.
Create a handler that returns the appropriate model to use based on geolocation. If you don’t want to create region specific apps, you can make your handler return the appropriate db to use based on geolocation info. Django makes it easy to specify the database to fetch information from.
If you want users to remain sticky to specific db when travelling, one way to do this will be to assign a db to users when they create accounts. You can save db and user authentication info when they log in and fetch from the appropriate database as before.
To me, the question needs more explanation. If a request is made of a server in the US, how does it make any sense to send a database query from that server in the US over to Luxembourg if that is in the proximity of where the user is located? Efficiency? No, that would actually cause double the traffic over close to the same distance. Different data? I would hope not, otherwise you should definitely just store the connection of a user to a database to be used.
In reality, the current location of the user should somewhat irrelevant, and known profile information (such as the user has previously accessed the US site even though they are currently in Madrid) about that user should redirect them to the appropriate servers, probably using the subdomain strategy that Russell originally suggested. First time users could potentially be geo-redirected based on IP, but most interfaces I've seen just ask what resources they need (or the country they want to use) and redirect accordingly.
-James
Perhaps you can investigate more into the 'why' portion of the requirement (which is what I was interested in)? You may be able to convince them to abandon/modify their requirement if you lay out the technical issues and complication they are introducing, and for what gain?
I suspect the feature you are looking for doesn't have great support because a) there are (usually) better alternatives at other levels of the application stack (ie Russell's solution), or b) user data for an application is most often shared within a single database or c) redundancy or load sharing of the databases will likely be on the DB side rather than be controlled by the app itself. The app shouldn't care whether it is talking to a single database or a cluster of 100.
What you're trying to do isn't impossible, I was just trying to make sure the effort justifies the reward, although giving the customer what they want even though it is...suboptimal...and getting paid may be the "best" way to go, even though I'm cringing as I write that.
-James
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CANGESS-c_MZW%3Drdw%3D5oPv3Q0DuPRe4LDm9yGwPhhuhSvWsyUng%40mail.gmail.com.
...