Thursday, September 1, 2011

Multiple Database Routing Based on Site

I had a kind of crazy idea and I wanted to bounce it off of some
people with a lot more django experience than I.

Here's my scenario...

I would like 1 code base, this code base services potentially hundreds
of businesses, each of which I want to have a copy of the same schema
but with data only relevant to that business.

Basically my idea is the following
If the model is a Site object or User object, route to the default
database, otherwise route reads and writes to a database name I'll set
in the sites table.

The trick is I need to set the SITE_ID for the current request, and
I'm not sure exactly When that should happen (after login of course),
or if this idea is even workable.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment