What’s the difference between a project and an app in Django world?

A project refers to the entire application and all its parts.

An app refers to a submodule of the project. It’s self-sufficient and not intertwined with the other apps in the project such that, in theory, you could pick it up and plop it down into another project without any modification. An app typically has its own models.py (which might actually be empty). You might think of it as a standalone python module. A simple project might only have one app.

For your example, the project is the whole website. You might structure it so there is an app for articles, an app for ranking tables, and an app for fixtures and results. If they need to interact with each other, they do it through well-documented public classes and accessor methods.

The main thing to keep in mind is this level of interdependence between the apps. In practice it’s all one project, so there’s no sense in going overboard, but keep in mind how co-dependent two apps are. If you find one app is solving two problems, split them into two apps. If you find two apps are so intertwined you could never reuse one without the other, combine them into a single app.

Leave a Comment