Hi All,

Could you please help me work around the following behaviour in Django
framework

Actual Behaviour:

./manage.py shell
>>> from multidb.foo.models import *
>>> from multidb.settings import *
>>> DATABASES['secondarydb']['NAME'] = '/usr/src/multidb/secnario1.db'
>>> res = Result.objects.using('secondarydb').all()
>>> print res[0].cmd
runtest /usr/src/testscript/scenario1.test
>>> res = None
>>> DATABASES['secondarydb']['NAME'] = '/usr/src/multidb/secnario2.db'
>>> res = Result.objects.using('secondarydb').all()
>>> print res[0].cmd
runtest /usr/src/testscript/scenario1.test

Django framework is not able to load the new database for the second
time:
the following statement is ineffective, instead the framework refers
to '/usr/src/multidb/secnario1.db' always
DATABASES['secondarydb']['NAME'] = '/usr/src/multidb/secnario2.db'

Setup:

I have two sqlite database file,

1. scenario1.db
2. scenario2.db

Each of these db contains data in the table named "result' and their
schema are equal.

On the other hand I have created a Django project named: multidb,
which has a app named 'foo' which is equipped with the model code
necessary to communicate with these database.

In the settings.py of this project I have configured the database to
be:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'test',
        'USER': 'mysql',
        'PASSWORD': 'password123',
        'HOST': 'localhost',
        'PORT': '',
    },
    'secondarydb' : {
        'ENGINE' : 'django.db.backends.sqlite3',
        'NAME': '',
        'USER' : '',
        'PASSWORD' : '',
        'HOST' : '',
        'PORT' : ''
    }
}

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

Reply via email to