Against service layers in Django (2020)
b-list.org
b-list.org
Also, may just be me, but I've mostly seen just bad Django apps - God object patterns galore, the schema/orm/business logic all being very tightly coupled and essentially nothing is able to be refactored because of this. They often have to be simply thrown away and you start over.
But, I think having an explicit service interface solves a lot of these problems - as long as you maintain the interface and pass back the same type of object, you're free to talk to whatever backing store you like. And you get a lot less issues with circular imports and whatnot in my experience. ymmv
> And if, after reading this, you still are convinced that a service-layer approach with business logic separate from the data models is the right thing for you, then go for it, but I’ll urge you one last time to at least strongly consider not doing it with Django, and instead building on top of a component stack that uses a Data Mapper ORM (in the Python world, SQLAlchemy is far and away the best choice) that natively incorporates that type of separation. In the long term, I think that’s going to be a much happier and more productive path than trying to fit the square peg of a service layer into the round hole of Django’s Active Record approach.