Course Content
Django: First Dive
Django: First Dive
2. Write the First Page
4. Working with Database
Start Project
To start a project, we should create a Virtual Environment for this project.
You can create a new project using the IDE or perform a few actions:
Step 1. Install Django using the following command:
Note
If
pip
doesn't works, try thepip3
.
Step 2. Initialize a new Django project using the following command:
The command django-admin startproject Main .
is used to create a new Django project with the name "Main" in the current directory. Let's break it down:
django-admin
: This is the command-line utility provided by Django that allows you to perform various administrative tasks related to Django projects.startproject
: This is a subcommand ofdjango-admin
that is used to create a new Django project.Main
: This is the name given to the Django project. You can replace "Main" with any desired name for your project. This name will be used as the project's directory name and as a reference in various Django settings..
: The dot represents the current directory. By including the dot at the end of the command, you are indicating that you want to create the Django project in the current directory instead of creating a new subdirectory.
In summary, running django-admin startproject Main .
creates a new Django project with the name "Main" in the current directory, setting up the initial structure and files needed for a Django project.
After executing the command in the Terminal, a built project with the following structure awaits us:
Everything was clear?