When to create a new app (with startapp) in Django?

前端 未结 8 2000
余生分开走
余生分开走 2020-12-12 15:44

I\'ve googled around for this, but I still have trouble relating to what Django defines as \"apps\".

Should I create a new app for each piece of functionality in a

8条回答
  •  执念已碎
    2020-12-12 16:28

    I prefer to think of Django applications as reusable modules or components than as "applications".

    This helps me encapsulate and decouple certain features from one another, improving re-usability should I decide to share a particular "app" with the community at large, and maintainability.

    My general approach is to bucket up specific features or feature sets into "apps" as though I were going to release them publicly. The hard part here is figuring out how big each bucket is.

    A good trick I use is to imagine how my apps would be used if they were released publicly. This often encourages me to shrink the buckets and more clearly define its "purpose".

提交回复
热议问题