[Django]-Implementing MVC pattern with Django Rest Framework


You need to understand that web service (which you are going to implement with Django) and your client app (which you are going to implement with Angular) are totally different apps and they should not depend on each other. These apps will have their own Models, Views and Controllers.

If we are talking about some business logic that you need to store somewhere on a backend then you can use an approach where you will have an additional level (usually, people call it services.py) and you will import code from this layer to views.py and only call it there cause your views should stay clean and simple as much as possible.

In an ideal case, especially, at the start, I guess, you will not have some tricky logic and mostly your API will look like simple CRUD, so for that case, you even don’t need to store additional logic somewhere you just can use rest framework ViewSets as is and store some little snippets in utils.py.

The bottom line is – you don’t understand fundamentals that’s why you asked the wrong question. And you don’t need it right now. Just go and write your app and read the docs about frameworks that you are using, eventually, you will understand this topic.

Leave a comment