That was a simple typo in Dennis' reply. Use \ if model == 'Session'
instead and that error will disappear. regards Steve On 7/30/2010 1:03 PM, Jocelo wrote: > Hi, Thanks for your previous reply. I'm still having problems... now > I'm getting the following error: > > NameError: global name 'Session' is not defined > > I check up the documentation, I understand that > 'django.contrib.sessions.backends.db' makes the Session model > available in the DB router .... so, just by setting the > 'django.contrib.session' in my INSTALLED_APPS is enough ? What am I > missing ? > > Thanks again. > > On Jul 29, 3:39 pm, Dennis Kaarsemaker <den...@kaarsemaker.net> wrote: >> 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-da...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 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.