On do, 2010-07-29 at 13:03 -0700, Jocelo wrote:
> Hi,
>
> I have two DB configured on my django project... one in oracle and the
> other one in MySQL...
> My Oracle DB is the default one, and on MySQL I store data that is not
> really related to my main application.
>
> I want to store session data in MySQL, since oracle is legacy but
> whenever I try to store something on my session object
> ("request.session['temp']=1"), django looks for django_session table
> on Oracle, crashing completely my app.
>
> I have read something about dabatase routing, but I'm not sure if this
> is the way to go for this.
It is the way to go.
> How can I make django look for django_session's table on my
> "secondary" MySQL DB ?
http://docs.djangoproject.com/en/dev/topics/db/multi-db/#automatic-database-routing
has all the details. your router would look like:
class MyRouter(object):
def db_for_read(model, **hints):
if model == Session:
return 'secondary'
db_for_write = db_for_read
--
Dennis K.
They've gone to plaid!
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.