0
0
DjangoConceptBeginner · 3 min read

What is installed_apps in Django: Explanation and Usage

In Django, INSTALLED_APPS is a list in the settings file that tells Django which apps are active for your project. It helps Django know where to find models, views, templates, and other app components to include in your project.
⚙️

How It Works

Think of INSTALLED_APPS as a guest list for a party. Django only invites the apps listed here to participate in your project. Each app can add features like database models, admin pages, or templates. When Django starts, it looks at this list to load and connect these apps properly.

This list is in your settings.py file and usually includes both your own apps and built-in Django apps. By listing an app here, Django knows to check it for database tables, static files, and other resources it needs to run your site.

đź’»

Example

This example shows a simple INSTALLED_APPS list in a Django settings file. It includes default Django apps and a custom app called blog.

python
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'blog',  # Custom app
]
🎯

When to Use

You use INSTALLED_APPS whenever you add a new app to your Django project. This includes apps you create yourself or third-party apps you install. Adding an app here lets Django include its features, like database models or admin interfaces.

For example, if you add a blog feature, you create a blog app and add it to INSTALLED_APPS. Django then knows to create database tables for the blog and show its admin pages.

âś…

Key Points

  • Lists active apps: Only apps in INSTALLED_APPS are used by Django.
  • Includes built-in and custom apps: Both Django’s default apps and your own apps go here.
  • Controls database and admin setup: Django uses this list to create tables and admin pages.
  • Must update when adding apps: Always add new apps here to activate them.
âś…

Key Takeaways

INSTALLED_APPS tells Django which apps to include in your project.
Add every new app you create or install to INSTALLED_APPS.
Django uses this list to set up database tables and admin interfaces.
It includes both built-in Django apps and your custom apps.
Without listing an app here, Django will ignore it.