Python - install and run Django
In this article, we would like to show you how to install and run Python Web framework - Django.
To install Django you need to:
- create a new folder for your Django project,
- open Command Prompt and change directory to the Django project folder,
- create and activate a virtual environment,
- install Django,
- start the actual Django project.
After you create a new Django project and open Command Prompt with its directory create a new virtual environment using the following command:
xxxxxxxxxx
python -m venv environment_name
then activate it using:
xxxxxxxxxx
environment_name\Scripts\activate
Now, when you have your virtual environment activated use the following command to install Django:
xxxxxxxxxx
pip install django
When you have Django installed use the command below to create an actual Django project:
xxxxxxxxxx
django-admin startproject project_name
After you create the project, change the directory with cd project_name
command and start an app using:
xxxxxxxxxx
python manage.py startapp app_name
This will create a new directory called app_name
.
Now open your project with some code editor (e.g Visual Studio Code), go to your project's settings.py file and add app_name
to the INSTALLED_APPS
list like this:

You can now run the app_name
with the following command:
xxxxxxxxxx
python manage.py runserver
You should get the result like this:
Now copy the selected fragment from your console and paste it in your browser to see if the install worked successfully.
Result:
