On Sun, Mar 8, 2015 at 9:15 PM, 'Petros Moisiadis' via Django users <
django-users@googlegroups.com> wrote:

> 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.
>

Yes, DB Routers support hints. How are you planning to inject those hints
into the router? Router arguments aren't exposed to the end user when you
do a query - they're automatically generated by the query, and only include
details about related objects in the query.

Yours,
Russ Magee %-)

-- 
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/CAJxq84_UzaEekcCGOmbUHwKV8EB3goQKLRt_J2ARXzX_mYvy%2Bw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to