Django 1.2: Several Basic and Common Content Types

I am working on one project with django 1.2.

I have 2 databases: - Firstly, for users, user profile, session ... - Secondly, to store data from my specific models, such as a blog post, pictures, files ...

I created a router (dbrouter.py) to control where each model is stored (instead of using "use" for each set of queries). When I synchronize my project, there are no problems.

So, I need a content type structure in the first and second databases. Now, how do I do to declare a contenttypes application in my two databases and how will I be sure that the content type data is synchronized in my two two databases?

The only workaround I found was the following:

  • Declare a contenttypes structure twice in settings.py.
  • Managing with dbrouter these two types of content for each database
  • When I synchronize the project, only the django_content_type table from my first database is updated with data.
  • Manually copy the data from the first database (table django_content_type) to the second.

Finally, can you tell me which recommendations are best used for managing content types in multiple databases?

+3
source share
1 answer

, " " , , . - // .

0

Source: https://habr.com/ru/post/1753567/


All Articles