Understanding Django’s Apps and AppConfig

Mohammad Asim Ayub
CodeX
Published in
4 min readApr 24, 2021

--

Photo by Paul Hanaoka on Unsplash

Introduction

A Django project is a collection of apps that work together to deliver a set of functions. This collection consists of apps provided by Django, ourselves and other developers. In a project, the full set of apps belonging to a project is found in the projects settings.py , declared as the INSTALLED_APPS variable.

Apps and AppConfig creation

When the application server starts (django-dev server or uwsgiserver), it loads the settings defined for the project to configure the site. The variable DJANGO_SETTINGS_MODULE defines the correct settings for the environment where your app is running i-e development or production. The loading process involves the loading of the URL configurations defined by each app and creating the URL tree structure. But before it does this and any of the other settingstasks, it needs to know about all the apps in the project. Hence as part of loading the project settings, the application server takes the INSTALLED_APPS and loads or generates an AppConfig object for each app. This collection of AppConfig objects are then stored in an instance of theApps class. This instance of the Apps class is called the master registry. This master registry is the registry for the entire Django project that is being run by this application server.

--

--

Mohammad Asim Ayub
CodeX

A DevOps engineer by profession. I love learning about new technologies and sharing my learning with others. Visit me @ www.asimayub.com