4

First of all, the goal of this exercise is to create a SOA with Django.

I am trying to understand what the implications would be if I decided to separate and insulate models into apps, provide a REST API for accessing those apps and then create other apps which basically use the REST API to obtain data and perform operations on the models (DB).

I have been reading documentation and playing with Django for a while (not too long), but, as far as I can tell, the only important Django features I would be forefeiting are the ability to use generic views and forms. Since I am not really very experienced with Django I'd like to get more insight before I jump into it.

  • What other really useful Django features would I lose?
  • Is there a way to overcome this without exposing the models to other Apps?
2

What other really useful Django features would I lose?

"Lose" is probably the wrong way to think about it. Never use and just take up space is probably more accurate. It could be argued that Django is too big a framework for what you are describing. Is there any particular reason why you have to use Django? A micro-framework like Flask might fit the requirements better, it is light weight and would not include a lot of code you will never use.

Is there a way to overcome this without exposing the models to other Apps?

You don't expose models via HTTP, you expose resources. Some times resources will be the same as the model, but other times they won't. Some web frameworks map models to resources in a 1 to 1 fashion but this is considered these days to be a bad idea to hard code this mapping, as it makes your apps much less flexible (your model might change as the app grows but you would not necessarily want your resources to change)

So think of resources and your domain model as two related but separate things.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.