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

Tags: django python
By : Håkan
Source: Stackoverflow.com

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 site, even though it uses models from the main project?

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?

By : Håkan


James Bennett has a wonderful set of slides on how to organize reusable apps in Django.

Here is the updated presentation on 6 September 2008.



Taken from the slide

Should this be its own application?

  • Is it completely unrelated to the app’s focus?
  • Is it orthogonal to whatever else I’m doing?
  • Will I need similar functionality on other sites?

If any of them is "Yes"? Then best to break it into a separate application.

By : Yeo

The rule I follow is it should be a new app if I want to reuse the functionality in a different project.

If it needs deep understanding of the models in your project, it's probably more cohesive to stick it with the models.

By : Ryan

This video can help you solving your question :)
By: admin