Learn Django

Understanding Apps

Django projects have two fundamental organization structures. First, there's the concept of the Django project itself. During setup you may recall that the project was created in the /.../crmeasy directory using the django-admin startproject crmapp . command. That created the base working directory and installed some key configuration files like settings.py and urls.py.

Django's second fundamental organization structure is referred to as an app. The best practice is to break a project's functionality down into logical units, and create an app for each one. This is probably best explained with an example.

A CRM application could be broken down as follows:

  • An accounts app to track customers
  • A contacts app to track the employees of a customer
  • A communications app to track meetings, phone calls, and email exchanges
  • A marketing app to contain the resources used to market the application

The purpose of breaking down a project into logical units like this is to make it easier to manage, as well as leave open the possibility of reusing code. For example, we may find that the communications app could be used in another project. By building it in an app we can easily import it elsewhere.

Track your progress with a free account