Wednesday, October 30, 2019

Multiple Database Setup

I wish to create a project with 2 apps.  Each app will have its own database - one for payments and another for statements. 

I have created a set of models within the models.py for the payments app and another set of models inside within the models.py for the statements app.

When I run the command "python manage.py migrate --database=statements" how will Django know to look at the models.py file inside of the statements app and create those tables in the statements database ?   

In other words where do I put the code that connects the models inside of an app (statements/models.py) to the database that those models should be created and stored in?
What would be an example of what this code will look like?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/06bf4cc7-7261-4ac8-95fb-d523528c77e2%40googlegroups.com.

No comments:

Post a Comment