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

Conteúdo do Curso

Django: Build Your First Website

Django: Build Your First Website

1. Get Started
2. The First Application
3. Models
4. CRUD Operations
5. Templates
6. Forms and Dynamic URLs

bookDjango 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?

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

Selecione a resposta correta

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 1
We're sorry to hear that something went wrong. What happened?
some-alt