On Feb 13, 7:43 am, PDani <pekdan...@gmail.com> wrote: > Hi! > > I would like to set up some database servers in Django 1.2, and then > use them in this way: when a new request comes, i choose a server > manually, and then use this ONLY ONE server in that request. I don't > want to pass around parameters, which server i chosen, so somehow, i > would like to make the chosen server the "default" server for that > request. > Here's an example: > - somebody gets a page > - based on who is the person, and what page, i decide which db server > should i use > - i select it (how?) > - then every query will be routed to this server without having to use > explicitly using(), and friends, until the end of that concrete > request > Any idea how should I do this?
How many databases do you have? If it is a small number, then you could be a bit tricky with Apache/ mod_wsgi and create multiple daemon process groups where the Django configuration for the database changed based on the name of the process group a request was handled in. You could then use cookies and/ or in conjunction with session information, to dynamically control to which daemon process group mod_wsgi delegated the request. In other words, rather than try and switch a single instance to different databases on the fly, you have one instance per database and control to which the request actually gets passed to. A can explain more later if that would at all be practical. Graham -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.