3

I am working on one project with django 1.2.

I have 2 databases : - First, for users, user's profile, session ... - Second is to store data from my specifics models like post of blog, pictures, files ...

I made a router (dbrouter.py) to manage where each models are stored (instead of using 'using' for each queryset). When I sync my project there is no problem.

So, I need content types framework in first and second databases. Now, how do I do to declare contenttypes app on my two databases and how I will be sure that data of contenttypes are synchronized on my two databases ?

The only workaround I found, was :

  • Declare contenttypes framework two times in settings.py.
  • Manage with dbrouter this two contenttypes for each databases
  • When I sync project, only table django_content_type from my first database is updated with data.
  • Manually I copy data from first database (table django_content_type) to the second.

Finally, can you tell me what are the best practices when you want to manage content types on multiple databases ?

Julien
  • 35
  • 5
  • This isn't officially supported: https://docs.djangoproject.com/en/dev/topics/db/multi-db/#limitations-of-multiple-databases. – Chris Lawlor Jul 03 '12 at 12:40

1 Answers1

0

I think the "best practice" here would be to not use two different databases in the way you are doing. I can't think of any truly useful reason to separate out users/profiles/sessions from the rest of the data for your application.

Frank Wiles
  • 1,589
  • 11
  • 13