database router raises TypeError: expecting router class instance as first argument
I'm having trouble with database routers in a Django 1.3.1 project.
I'm by no means a Django or Python expert, but I've been using Django
for a few years now. When I enable any kind of router in my project,
it throws a TypeError like the following:
"unbound method db_for_read() must be called with DBRouter instance as
first argument (got ModelBase instance instead)"
I've tried a few different examples based on the Django documentation,
but it seems like I am missing something basic here.
Does anybody have an idea what I've done wrong? Please let me know if
you need more information.
Here's some background:
The new database is used by a new app with a model in the app's
models.py. Using the shell I've proved that the database and model are
OK.
The routers.py is in the new app. The settings file imports the router
class, and includes the following line:
DATABASE_ROUTERS = [ DBRouter, ]
Here's the basic layout:
project
settings.py
app1 (uses database 1)
models.py
app2 (uses database 2)
models.py
routers.py
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home