49
votes

I'm new to Django and trying to understand the preferred means of operation when deploying web applications.

Let's say I'm making a web application with (for example) user login management, some uploading functionality, manipulation of uploaded files, and rendering uploaded files on screen. They're all part of the same "web application".

Would each of these functions be its own app in the project, or should these all be together a single app? Is a Django app intended to correspond to a web application, or does it correspond to a single set of functions interfacing with a few tables in the database?

2

2 Answers

24
votes

A Django app is a group of related functionality used to complete or maintain one aspect of a site. The web application you describe would be separated into at least 2 Django apps, depending on how granular you want to make the handling of the uploaded files.

31
votes

There's a distinction to be made between reusable apps and non-reusable apps. For reusable apps it's essential that they offer well defined functionality and are intended to solve a well defined problem. If this wasn't the case, they wouldn't be very reusable.

However you're likely to also have some non-reusable apps, i.e. one or more apps in a project that implement application logic that's specific to the project. In my projects I always have a non-reusable app called core that acts as glue and ties everything together. If I have distinct sections in my site I may choose to have more non-reusable apps, because I like the way it essentially namespaces my project (e.g. models, views, templates, etc.)