Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Start App | Get Started
Django: First Dive

Start App

Let's move on to creating apps for our project. Speaking of the project itself, it is a web application, but the apps created within the Django project are like modules that will be used in our application.

Distributing server logic into separate modules allows us to organize the server functionality logically. For example, we can have a module dedicated to the user account system for an online store, and a separate module for handling information about products, their descriptions, and prices.
As a result, it will be very convenient to read the server's functionality, fix bugs, and simply monitor the server's behavior.

Let's explore the ways to create app modules.

Step 1. Start app via terminal. To start (create) new app in Django project, you should use the following command in the terminal:

Let's break it down:

  • python: This command is used to run Python scripts through the terminal.
  • manage.py: This is a script generated by Django when you create a new project. It serves as the command-line interface for managing various aspects of your Django project.
  • startapp: This is a command provided by Django's manage.py script. It is used to create a new app within the Django project.
  • new_app: This is the name you provide for the new app. Replace new_app with the desired name for your app. Choose a meaningful and descriptive name that reflects the purpose of the app. Avoid using spaces or special characters in the app name.

When you run python manage.py startapp new_app, Django will create a new directory named new_app within your project's directory. This directory will contain the necessary files and folders to structure your new app.

Step 2. Add your app to the settings. Find the file settings.py in the main project directory (main project core) that was named when you run the django-admin startproject command.

For the example, the project created in third chapter was named Main. In the Main folder you can find the settings.py.

Open the settings.py and add your app name to the INSTALLED_APPS list:

Now, the new_app is connected to the main core of the Django project.

What command should be used in the terminal to initialize the project?

Select the correct answer

Everything was clear?

Section 1. Chapter 4
course content

Course Content

Django: First Dive

Start App

Let's move on to creating apps for our project. Speaking of the project itself, it is a web application, but the apps created within the Django project are like modules that will be used in our application.

Distributing server logic into separate modules allows us to organize the server functionality logically. For example, we can have a module dedicated to the user account system for an online store, and a separate module for handling information about products, their descriptions, and prices.
As a result, it will be very convenient to read the server's functionality, fix bugs, and simply monitor the server's behavior.

Let's explore the ways to create app modules.

Step 1. Start app via terminal. To start (create) new app in Django project, you should use the following command in the terminal:

Let's break it down:

  • python: This command is used to run Python scripts through the terminal.
  • manage.py: This is a script generated by Django when you create a new project. It serves as the command-line interface for managing various aspects of your Django project.
  • startapp: This is a command provided by Django's manage.py script. It is used to create a new app within the Django project.
  • new_app: This is the name you provide for the new app. Replace new_app with the desired name for your app. Choose a meaningful and descriptive name that reflects the purpose of the app. Avoid using spaces or special characters in the app name.

When you run python manage.py startapp new_app, Django will create a new directory named new_app within your project's directory. This directory will contain the necessary files and folders to structure your new app.

Step 2. Add your app to the settings. Find the file settings.py in the main project directory (main project core) that was named when you run the django-admin startproject command.

For the example, the project created in third chapter was named Main. In the Main folder you can find the settings.py.

Open the settings.py and add your app name to the INSTALLED_APPS list:

Now, the new_app is connected to the main core of the Django project.

What command should be used in the terminal to initialize the project?

Select the correct answer

Everything was clear?

Section 1. Chapter 4
some-alt