Download & Install Django

To get started with using the Django framework you can select an LTS (Long Term Support) version of Django and simply install it using pip.

Django versions

If you are reading this tutorial between 1st April, 2021and 31st March 2024 then Django 3.2 is the version to use. It is an LTS or Long Term Support Version. The next release Django 4.2 is scheduled after that.

Pre-requisites to install Django

  • Step 1: Install Python 3.5 or above from Python.org
  • Step 2: Verify Python installation with 
python --version
  • Step 3: Update Python package manage, pip using
python -m pip install --upgrade pip

Download Install Django on Windows 10

We do not need to download an exe or dmg version of Django manually. Django is a python package under PyPI (Python Package Index). We can install python packages under PyPI by using the package manager called pip.

  • Step 1: To install Django with the pip run:
pip install django==3.2
  • Step 2: Verify Django installation with
django-admin --version

Install Django on Ubuntu or Mac OSx

Ubuntu or Mac OS might refer to python as python3. In this case, we can do aliasing like alias python = /usr/bin/python3. We may sometimes need to install pip as well.

  • To install pip first, run 
curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
  • then follow it with the command
python get-pip.py
  • Lastly, to install Django run: 
pip install django==2.2

Install Django in Virtual Environment

Virtual environments can help maintain different software versions or Django versions under the same operating system. It is recommended if there are many users for your computer who would like to work with different versions of Python or Django.

To install virtual environment simply, run:

pip install virtualenv

To create a new virtual environment named myenv, run:

virtualenv myenv

To start/activate the virtual environment simply, run:

myenv\Scripts\activate

On a Mac or Linux environment use the below command to activate the virtual environment

source venv/bin/activate

To deactivate the virtual environment, run:

deactivate