1
Django Installation
Aravinda Thejas Chandra
Install Python 2
Install Python https://www.python.org/downloads/
Download the executable installer and run it
Then click “Install Now”.
After installation, open the command prompt and check that the
Python version using command
prompt\> py --version
Setting up a virtual environment 3
It is best practice to provide a dedicated environment for each Django project you create.
Python itself comes with module venv for managing environments.
py -3 -m venv .venv (.venv is name of virtual environment, provide name of your choice)
Enable Running scripts in windows power shell
Run powershell as administrator and execute the command
set-executionpolicy remotesigned
To activate virtual environment run following command
.venv\scripts\activate
Install Django 4
In the command prompt, ensure your virtual environment is active, and execute
the following command
py –m pip install django ( pip stands for preferred Installer Program
pip is a package installer for python)
Colored terminal output
➢ To make your terminal colored use the following command
py –m pip install “coloroma >= 0.4.6”
➢ Check the Installed Django version using following command
Python –m Django --version
Create Django project 5
Execute the following command to create a new Django project
django-admin startproject project-name
Change directory to Project directory using command
cd project-name
Create an app in Django app using following command
Python manage.py startapp app-name
Run run Django Development Server using following command
(you should go to project-name folder)
python manage.py runserver
Django development server running 6
In Browser URL type 127.0.0.1:8000