business logic in Django
django, python
Solution
Short answer: Django is more of a MTV or MVT (Model / Template / View), as described in the official FAQ : https://docs.djangoproject.com/en/dev/faq/general/#django-appears-to-be-a-mvc-framework-but-you-call-the-controller-the-view-and-the-view-the-template-how-come-you-don-t-use-the-standard-names
The business logic has its place in your views, but nothing prevents you from putting it inside a "utils.py", "services.py" or anything to your liking.
Problem
I'd like to know where to put code that doesn't belong to a view, I mean, the logic. I've been reading a few similar posts, but couldn't arrive to a conclusion. What I could understand is: - A View is like a controller, and lot of logic should not put in the controller. - Models should not have a lot of logic either. So where is all the logic based stuff supposed to be? I'm coming from Groovy/Grails and for example if we need to access the DB or if we have a complex logic, we use services, and then those services are injected into the controllers. Is it a good practice to have .py files containing things other than Views and Models in Django? PS: I've read that some people use a `services.py`, but then other people say this is a bad practice, so I'm a little confused...