Django Orm as Stand alone project and Have Django project with managed= false

@KenWhitesell

I have a project where I want to use Django ORM in 2 different projects of Django tech stack,
It shares the same database and fewer models approximately 80+ models it shares the same model and it uses the same database of PostgreSQL.

@KenWhitesell

Am building both project in Django for a different purpose, where I don’t want use them as an app it was a different usage and vendor but same purpose of functionality of models

so am planning to keep as below

  1. Keep a stand-alone django orm project for data version & migration to db alone
  2. keep a separate Django project with models managed = false and 2nd project also the same concept

so that I can use form stand-alone project as decouple with both projects and manage easy deployment and decoupled db migration

Would that work? any pitfalls? in this approach?

1 Like

There’s no need to set this up as two separate projects.

It’s safer and easier to manage if this is maintained as one project with separate and independent components.

We do this a lot. We’ve got projects where one part of it is a traditional Django app, and the other part are a set of custom management commands to run code associated with the same set of modules. We’ve also done projects where two different apps share the same set of models. The models are in their own app to isolate them from the code used by both of the other apps. Each of the separate projects have their own settings files for providing separate configurations.

ok, which means, One Django project with 2 apps in Django Project correct?
But My clients are different and have a separate use case for each, some features are generic to both projects so they share the same model and the same database (this is important ), and some features are specific to that client
example:- assume we have projects & project 2 with the same database, if any changes in the model for project 1 or client 1 , where they want to add a new feature or index for performance tune, I just ran the stand-alone model project, and no need to re-deploy the project 2 code in Django
So since the database is common, I want to decouple the Django ORM in a separate project and use it so that I can deploy if any db changes as only migration, no need to affect other client 2 Django project because of the db change by client 1

kindly suggest.

Or I can have a separate app the models alone so that I can import in both the project and work and re-use the models. if any changes in db alone, I can just run migration alone on prod, with out touching or making down the application. is it ok this approach