Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Django Applications | The First Application
course content

Course Content

Django: Build Your First Website

Django ApplicationsDjango Applications

Project and Applications

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 apps allows us to organize the server functionality logically. For example, we can have a app dedicated to the user account system for an online store, and a separate app 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.

Create a new Application

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

If the command above doesn't work, try inputting this python3 manage.py startapp main.

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

Connect App to Project

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 named main. In the main folder you should find the settings.py;
  • Open the settings.py and add your app name to the INSTALLED_APPS list:

Now, the main app is connected to the the Django project.

What does this python manage.py startapp main command do?

Select the correct answer

Everything was clear?

Section 2. Chapter 1
course content

Course Content

Django: Build Your First Website

Django ApplicationsDjango Applications

Project and Applications

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 apps allows us to organize the server functionality logically. For example, we can have a app dedicated to the user account system for an online store, and a separate app 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.

Create a new Application

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

If the command above doesn't work, try inputting this python3 manage.py startapp main.

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

Connect App to Project

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 named main. In the main folder you should find the settings.py;
  • Open the settings.py and add your app name to the INSTALLED_APPS list:

Now, the main app is connected to the the Django project.

What does this python manage.py startapp main command do?

Select the correct answer

Everything was clear?

Section 2. Chapter 1
some-alt