Create and set up simple Django project

Create virtual environment and working directories for Django.

Let’s make a directory.

mkdir Project
Go there

cd Project
Installing a virtual environment

python -m venv .venv
Now, activate virtual environment.
Linux icon
Windows icon

source ./.venv/bin/activate
        

source ./.venv/Scripts/activate
        
To check a successful activated virtual environment, execute this command to be sure:

pip list
We will see either 0 or a couple of them. Or we can run a next command on the Linux system.

which python
And if the displayed path to Python is in our working directory, i.e. Project/.venv so everything is working.

How to create Django project

Install a package called Django.

pip install django
Start a new project called Project1

django-admin startproject Project1
Go to Project1

cd Project1
Accept all migrations.

./manage.py migrate

How to start Django project / testing it

Now you can be able to start start testing(local) server.

./manage.py runserver
If everything is done right, you shall see:
successfully launch django project ship

heart
0
3 connected dots
0

Used termins

Related questions