#12767: Problem running syncdb with a multi-db router that restricts auth to a
single database
------------------------------------------+---------------------------------
Reporter: russellm | Owner: nobody
Status: new | Milestone: 1.2
Component: Database layer (models, ORM) | Version: 1.2-alpha
Keywords: | Stage: Unreviewed
Has_patch: 0 |
------------------------------------------+---------------------------------
Via Klemens Mantzos on django-users:
If i do
{{{
python manage.py syncdb --database=default
}}}
before i sync the users database this error comes up (which seems ok to
me):
{{{
django.db.utils.DatabaseError: (1146, "Table
'multidb_user.auth_permission' doesn't exist")
}}}
but if i do this:
{{{
python manage.py syncdb --database=users
}}}
i get that every time (no matter if django_content_type already exists in
the default db or not):
{{{
django.db.utils.DatabaseError: (1146, "Table
'multidb_user.django_content_type' doesn't exist")
}}}
== Router config ==
{{{
# don't know but OtherRouter is maybe obsolete.
DATABASE_ROUTERS = ['dbrouter.AuthRouter', 'dbrouter.OtherRouter']
}}}
== project/dbrouter.py ==
{{{
class AuthRouter(object):
"""A router to control all database operations on models in
the contrib.auth application"""
....
def allow_syncdb(self, db, model):
"Make sure the auth app only appears on the 'credentials' db"
if db == 'users':
return model._meta.app_label == 'auth'
elif model._meta.app_label == 'auth':
return False
return None
class OtherRouter(object):
"""A router that sets up a simple master/slave configuration"""
...
def allow_syncdb(self, db, model):
"Explicitly put all models on all databases."
return True
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/12767>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" 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-updates?hl=en.