Create First App

Generate a new app with manage.py startapp, explore the app's files, and understand how apps encapsulate features within a Django project.

1. Introduction

In this guide we will create our first Django app inside the myproject project. An app is a self-contained module that handles one specific part of your website — for example a blog, a shop, or a contact form.

  • Your myproject project must already be created. If not, see Create First Project.
  • Your .venv must be active and Django 5.2 installed.
  • Your terminal must be inside the myproject folder — the one that contains manage.py.

2. Project vs app — a quick reminder

Before we create the app, let's make the distinction clear:

  • Project — the whole website. In our case that is myproject. It holds the settings, main URL config, and ties all apps together.
  • App — a single feature inside the project. One project can have many apps. Each app handles one specific job.

3. Create the app

Make sure your .venv is active and you are inside the myproject folder. Run:

python manage.py startapp pages

We are calling this app pages because it will handle simple pages in our project. We will use this same app in the next tutorial to build the Hello World example.

4. What was generated

Django creates a new folder called pages inside myproject. Your project structure now looks like this:

myproject/
├── .venv/
├── manage.py
├── requirements.txt
├── mysite/
│   ├── __init__.py
│   ├── settings.py
│   ├── urls.py
│   ├── asgi.py
│   └── wsgi.py
└── pages/
    ├── migrations/
    │   └── __init__.py
    ├── __init__.py
    ├── admin.py
    ├── apps.py
    ├── models.py
    ├── tests.py
    └── views.py

Here is what each file inside pages does:

  • migrations/ — stores database migration files. Django creates these automatically when you change your models. Do not edit them manually.
  • admin.py — register your models here to make them appear in the Django admin panel.
  • apps.py — configuration for this app. You reference this when registering the app in settings.py.
  • models.py — define your database tables here. Each class is a table, each attribute is a column.
  • tests.py — write automated tests for this app here.
  • views.py — write your view functions or classes here. Views receive requests and return responses.

5. Register the app in settings.py

Creating the app folder is not enough — you must tell Django it exists by adding it to INSTALLED_APPS in mysite/settings.py.

Open mysite/settings.py and find the INSTALLED_APPS list. Add 'pages' at the bottom:

# mysite/settings.py

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'pages',  # our new app
]

6. Verify the setup

Run the system check to confirm everything is wired correctly:

python manage.py check

You should see:

System check identified no issues (0 silenced).

7. Next steps

The pages app is created and registered. The next step is to write our first view, connect it to a URL, and see it in the browser — the classic Hello World example in Django.


Never miss a story on Django.wiki

Subscribe for fresh tutorials, snippets, and updates.

By subscribing you agree to our Privacy Policy.