About 20 models in 1 django app

前端 未结 6 734
太阳男子
太阳男子 2021-01-30 07:05

I have started work on a local app for myself that runs through the browser. Having recently gone through the django tutorial I\'m thinking that it might be better to use django

6条回答
  •  温柔的废话
    2021-01-30 07:55

    Having 20 models in one app might be a sign that you should break it up in smaller ones.

    The purpose of a Django app is to have a small single-purpose piece of code, that fits nicelly together.

    So, if you had a e-commerce site, you might have a shopping_cart app, a billing app, and so on.

    Keep in mind that there is really no problem in apps depending on each other (although it's always better if they can be decoupled), but you should not have an app doing two very distinct things.

    The article Django tips: laying out an application might help you. As always, take everything you read with a grain of salt (including this answer).

提交回复
热议问题