I setup my router following the docs.
Here's what my router.py looks like:
AUTH_APPS = ('auth',)
class MyRouter(object):
def db_for_read(self, model, **hints):
if model._meta.app_label in AUTH_APPS:
return 'auth'
return None
def db_for_read(self, model, **hin
Couldn't he also just add the router before syncdb and then they would
be created in the correct database?
Chris take a look at this documentation if you haven't already, it
explains routers which tell Django which database to use for a
particular query:
https://docs.djangoproject.com/en/dev/topic
While running syncdb command django uses default database to create
tables.
You can do one thing, first create default database using syncdb then
copy auth related tables to another database.
Then define router for auth. You can get more ref form django
documentatiion.
Regards,
Amit
On Mar 29, 4:
Has anyone been successful in putting the auth application in a
separate database so that users can be shared with different django
projects?
When I try to put the auth application in a different database I get
an error with syncdb:
django.db.utils.DatabaseError: relation "auth_permission" does n
4 matches
Mail list logo