Monday, November 11, 2013

Problem with syncdb and multiple databases

I’m using Django 1.5 and Mysql 5.1 and am in the early stages of a multiple app development and the schema is changing frequently as “hidden” requirements emerge.  I cannot get syncdb to sync anything other than my default db, and when I change my default, it still seems to see the old one.   Here is settings.py, with some junk removed for brevity.  Routers.py is attached and is in the same directory as settings.  I cannot figure out what’s going wrong with syncdb, but the normal application seems to work correctly.    I had commented out the “allow_syncdb” in the routers because I could not get it to work, it seems to have some impact but not sure what.

 

================settings.py=====================================

DATABASES = {

    'default': {'ENGINE': 'django.db.backends.mysql', 'NAME': 'accstaff'…    },

    'wnr': {   'ENGINE': 'django.db.backends.mysql', NAME': 'wnr'…    },

    'accstaff': {        'ENGINE': 'django.db.backends.mysql', 'NAME': 'accstaff'…    },

    'inserv': {  'ENGINE': 'django.db.backends.mysql', 'NAME': 'inserv'…    }

}

 

DATABASE_ROUTERS = ['AccWeeklyNursingReport.routers.WnrRouter',

                    'AccWeeklyNursingReport.routers.AccStaffRouter',

                    'AccWeeklyNursingReport.routers.AccInservRouter']

 

=====================================end settings.py===========================

 

The following is the output example

 

C:\all\django\AccWeeklyNursingReport>mysqladmin -f drop  accstaff

Database "accstaff" dropped

 

C:\all\django\AccWeeklyNursingReport>mysqladmin -f create  accstaff

 

C:\all\django\AccWeeklyNursingReport>python manage.py  syncdb --database=accstaff

allow syncdb for WnrRouter accstaff contenttypes

allow syncdb for WnrRouter accstaff sessions

allow syncdb for WnrRouter accstaff wnrapp

allow syncdb for WnrRouter accstaff wnrapp

allow syncdb for WnrRouter accstaff contenttypes

allow syncdb for WnrRouter accstaff sessions

allow syncdb for WnrRouter accstaff wnrapp

allow syncdb for WnrRouter accstaff wnrapp

Creating tables ...

allow syncdb for WnrRouter accstaff contenttypes

allow syncdb for WnrRouter accstaff contenttypes

allow syncdb for WnrRouter accstaff contenttypes

allow syncdb for WnrRouter accstaff contenttypes

allow syncdb for WnrRouter accstaff contenttypes

Installing custom SQL ...

Installing indexes ...

Installed 0 object(s) from 0 fixture(s)

 

C:\all\django\AccWeeklyNursingReport>echo DONE

DONE

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate