thx!

syncdb is now calling the database router before actually syncing to
the db. but...

...stumbled upon a new problem:

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")
(Traceback http://pastie.org/807571.txt)

seems that i'm the only one with this problem...but could find this ticket:
http://code.djangoproject.com/ticket/11828 (fixed aka. not
reproduceable aka. wontfix)

pretty sad. i need a extra user db, so i thought its pretty much the
same as in the example in the docu
(http://docs.djangoproject.com/en/dev/topics/db/multi-db/). except the
masterslave stuff. but it seems like i'm constantly overseeing stuff.

here is my code (again):
# 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

any suggestions?

thx for your time,
klemens


On Wed, Feb 3, 2010 at 13:21, Russell Keith-Magee
<freakboy3...@gmail.com> wrote:
> On Mon, Feb 1, 2010 at 11:07 PM, Klemens Mantzos
> <klemens.mant...@gmail.com> wrote:
>> hi list,
>>
>> checked out the new multidb feature
>> (http://docs.djangoproject.com/en/dev/topics/db/multi-db/).
>>
>> i assumed that syncdb would only sync those models in the database
>> when calling allow_syncdb() of the database routers return True. is
>> that true?
>>
>> my problem: syncdb syncs the complete model in the db. and i couldnt
>> even figure out if the DATABASE_ROUTERS are correctly configured and
>> working (django don't throws an error if the DATABASE_ROUTERS =
>> ['foo.bar'])
>>
>> ### Django version 1.2 alpha 1 SVN-12120
>
> Database routers weren't implemented until SVN-12272. You won't see
> any errors with an earlier checkout because the DATABASE_ROUTERS
> setting isn't being used at all.
>
> Yours
> Russ Magee %-)
>
> --
> 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.
>
>



-- 
klemens mantzos
http://fetzig.at/

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