Create and set up simple Django project

Clock
19.07.2024
Clock
19.12.2024
Clock
1 minute
An eye
42
Hearts
0
Connected dots
0
Connected dots
0
Connected dots
0

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

Comments

(0)

captcha
Send
It's empty now. Be the first (o゚v゚)ノ

Other

Used termins


Related questions


Similar articles


Commenting system for a website, using the Django framework

Clock
11.11.2023
In this article I will show how I implemented commenting on my website. Commenting, which is available to both anonymous and registered users.

Implementation of authentication system on django

Clock
30.10.2023
Let me make a reservation right away that the authentication system that you and I will write is not based on the built-in Django application, django.contrib.auth. This will be a …