Answer the question
In order to leave comments, you need to log in
Multiple databases in Django. Is it real?
Good day.
I read that Django supports multiple databases in one project. This just suits me, since there is a task to organize a structure of five stores with a common warehouse. Since prices in stores may differ, as well as the assortment itself, I decided to do it as follows:
Keep all information in two databases. The first database (unique for each store) will contain all the information about this store (customers, baskets, goods, prices, etc.) except for the number of goods in stock. And the quantity itself will be stored in a separate common database. In which there will be only product_ID , quantity_in_stock , reserved and threshold_quantity. But then I read that Django cannot bind a field via a ForeignKey to a different base. Can this be bypassed somehow? Or maybe I misunderstood something.
Or still leave this idea, and just make 5 different databases and synchronize them in three parameters from the warehouse? If this option is better, please tell me how to implement it.
Maybe someone will have a better solution. I will be very grateful for your help.
P.S. I'm new to Django (And this is not really Django, but Django-Oscar
) Sorry for my bad english.
Answer the question
In order to leave comments, you need to log in
> But then I read that Django cannot bind a field via a ForeignKey to another base.
And in general, some DBs can do this? How do you imagine it at all? Well, store there not a ForeignKey, but simply an int for some value, but you will have to take into account the handles. Well, you can easily have several databases, in django: https://docs.djangoproject.com/en/1.8/topics/db/mu... , I think you have already read it yourself.
No database can do this, it violates the very concept of the database.
Ideologically correct architecture:
- N individual stores that store their internal data in their databases.
- 1 shared service (with a separate database) that manages shared data and is accessed by others as needed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question