On 03/08/2015 01:42 AM, Russell Keith-Magee wrote:
> Hi Xina,
>
> The short answer is "not easily, and not within Django".
>
> Django's DB Routers don't contain any detail about the request, so
> there's no ability to geolocated the requesting IP for routing
> purposes. For the record, this is because Django is a general purpose
> toolkit - there's no guarantee that a request to access the DB has
> come as a result of a HTTP request - it might come from a standalone
> script, which won't have an IP address.
>

Django's DB routers have the notion of 'hints'. So, theoretically, a
hint with the HTTP request object could be passed to a db router (when
access to a database comes as a result of an HTTP request) or not passed
at all (if the database request is triggered by other means, e.g. a
standalone script). I am not saying that Xina's use case would be served
better with such an implementation though. Just pointing out that, in
theory, there should be no inherent restriction in Django supporting this.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/54FC4B6C.4040302%40yahoo.gr.
For more options, visit https://groups.google.com/d/optout.

Reply via email to