Django. One app with many models vs. many apps with single model

后端 未结 5 1817
眼角桃花
眼角桃花 2020-12-08 00:42

I\'m currently developing my own weblog in Django. But I\'ve already stucked right in the beginning. So, here is my tree hierarchy:

/pyroot/nemo         


        
5条回答
  •  没有蜡笔的小新
    2020-12-08 01:03

    Is it better to have one model per Django-app?

    One of the key ideas for a reusable application is: Do one thing, and do it well

    If an app needs several models (PostEntry, PostAuthor in case of a Blog App) this is by no means bad. Tags, Categories, Comments however represent distinct features which ideally can be reused in another context and therefore should be distributed as standalone apps.

    Is there best practices?

    To get a feeling for a good app organization I'd first take look at Django Reusable App Conventions.

    Then you are ready for James Bennett's talk about Resuable Apps from DjangoCon 2008 (Slides). Another, more recent take on the same subject is Pluggable Django Application Patterns from PyCon 2011

提交回复
热议问题