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

<p>Should I create a new app for each piece of functionality in a site, even though it uses models from the main project? </p>

<p>Do you guys have good rule of thumb of when to split off a new app, and when to keep functionality together with the "main project" or other apps?</p>

[{'answer_id': 64308, 'author': 'pobk', 'author_id': 7829, 'author_profile': 'https://Stackoverflow.com/users/7829', 'pm_score': 4, 'selected': False, 'text': '<p>I tend to create new applications for each logically separate set of models. e.g.:</p>\n\n<ul>\n<li>User Profiles</li>\n<li>Forum Posts</li>\n<li>Blog posts</li>\n</ul>\n'}, {'answer_id': 64464, 'author': 'blahspam', 'author_id': 8290, 'author_profile': 'https://Stackoverflow.com/users/8290', 'pm_score': 5, 'selected': False, 'text': '<p>I prefer to think of Django applications as reusable modules or components than as "applications". </p>\n\n<p>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.</p>\n\n<p>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. </p>\n\n<p>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".</p>\n'}, {'answer_id': 64492, 'author': 'Antti Rasinen', 'author_id': 8570, 'author_profile': 'https://Stackoverflow.com/users/8570', 'pm_score': 6, 'selected': False, 'text': '<p>James Bennett has a wonderful <a href="http://www.b-list.org/weblog/2008/mar/15/slides/" rel="noreferrer">set of slides</a> on how to organize reusable apps in Django.</p>\n'}, {'answer_id': 67769, 'author': 'willurd', 'author_id': 1943957, 'author_profile': 'https://Stackoverflow.com/users/1943957', 'pm_score': 1, 'selected': False, 'text': "<p>An 'app' could be many different things, it all really comes down to taste. For example, let's say you are building a blog. Your app could be the entire blog, or you could have an 'admin' app, a 'site' app for all of the public views, an 'rss' app, a 'services' app so developers can interface with the blog in their own ways, etc.</p>\n\n<p>I personally would make the blog itself the app, and break out the functionality within it. The blog could then be reused rather easily in other websites.</p>\n\n<p>The nice thing about Django is that it will recognize any models.py file within any level of your directory tree as a file containing Django models. So breaking your functionality out into smaller 'sub apps' within an 'app' itself won't make anything more difficult.</p>\n"}, {'answer_id': 68086, 'author': 'Ryan', 'author_id': 8819, 'author_profile': 'https://Stackoverflow.com/users/8819', 'pm_score': 3, 'selected': False, 'text': "<p>The rule I follow is it should be a new app if I want to reuse the functionality in a different project.</p>\n\n<p>If it needs deep understanding of the models in your project, it's probably more cohesive to stick it with the models.</p>\n"}, {'answer_id': 8034555, 'author': 'Yeo', 'author_id': 764592, 'author_profile': 'https://Stackoverflow.com/users/764592', 'pm_score': 4, 'selected': False, 'text': '<p>Here is the updated presentation on 6 September 2008.</p>\n<p><a href="https://youtu.be/A-S0tqpPga4?t=753" rel="noreferrer">DjangoCon 2008: Reusable Apps @7:53</a></p>\n<p><a href="http://media.b-list.org/presentations/2008/djangocon/reusable_apps.pdf" rel="noreferrer">Slide: Reusable_apps.pdf</a></p>\n<blockquote>\n<h2>Taken from the slide</h2>\n<p>Should this be its own application?</p>\n<ul>\n<li>Is it completely unrelated to the app’s focus?</li>\n<li>Is it orthogonal to whatever else I’m doing?</li>\n<li>Will I need similar functionality on other sites?</li>\n</ul>\n<p>If any of them is &quot;Yes&quot;? Then best to break it into a\nseparate application.</p>\n</blockquote>\n'}, {'answer_id': 53735156, 'author': 'Jonathan Berger', 'author_id': 518222, 'author_profile': 'https://Stackoverflow.com/users/518222', 'pm_score': 3, 'selected': False, 'text': '<p>The two best answers to this question I\'ve found around the web are:</p>\n\n<ol>\n<li>The Reusable Apps Talk (<a href="https://www.b-list.org/weblog/2008/mar/15/slides/" rel="noreferrer">slides</a>)(<a href="http://www.youtube.com/watch?v=A-S0tqpPga4" rel="noreferrer">video</a>) also mentioned in other answers. Bennett, the author and Django contributor, regularly publishes apps for others to use and has a strong viewpoint towards many small apps.</li>\n<li><a href="https://blog.doordash.com/tips-for-building-high-quality-django-apps-at-scale-a5a25917b2b5" rel="noreferrer">Doordash\'s Tips for Django at Scale</a> which gives the opposite advice and says in their case they migrated to one single app after starting with many separate apps. They ran into problems with the migration dependency graph between apps.</li>\n</ol>\n\n<p>Both sources agree that you should create a separate app in the following situations:</p>\n\n<ul>\n<li>If you plan to reuse your app in another Django project (especially if you plan to publish it for others to reuse).</li>\n<li>If the app has few or no dependencies between it and another app. Here you might be able to imagine an app running as its own microservice in the future.</li>\n</ul>\n'}, {'answer_id': 64463620, 'author': 'Milad Hatami', 'author_id': 7547739, 'author_profile': 'https://Stackoverflow.com/users/7547739', 'pm_score': 2, 'selected': False, 'text': '<p>The best answer to this question is given by Andrew Godwin (Django core developer):</p>\n<p>The main purpose of apps is, in my eyes, to provide logical separation of reusable components - specifically, a first-class namespace for models/admin/etc. - and to provide an easy way to turn things “on” or “off”.</p>\n<p>In some ways, it’s a relic of the time when Django was created - when Python packaging and modules were much less developed and you basically had to have your own solution to the problem. That said, it’s still a core part of Django’s mental model, and I think INSTALLED_APPS is still a cleaner, easier solution than Python’s replacement offering of entrypoints (which makes it quite hard to disable a package that is installed in an environment but which you don’t want to use).</p>\n<p>Is there anything specifically you think could be decoupled from the app concept today? Models and admin need it for autodiscovery and a unique namespace prefix, so that’s hard to undo, and I’m struggling to think of other features you need it for (in fact, if all you want is just a library, you can make it a normal Python one - no need for the app wrapping unless you’re shipping models, templates or admin code IIRC)</p>\n'}]
['https://Stackoverflow.com/questions/64237', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/8420/']