How To Install Django

2 min read

Django is a full stack open source web development framework written in Python that encourages rapid development and clean, pragmatic design. Since it's release in 2003 Django has proven to be one of the most efficient modern web frameworks. Over the years Django and Python are on an unstoppable train of success. If you are planning to begin your journey as a web developer it's the best MVC framework to start with. Read more about the origins of Django read: Django – Web Framework For Perfectionists.

In this article, we will go through the Installation process of Django.

Installing Django

As said, Django is a web framework written in Python, In order to install it first, you need to Install Python in your system. To check whether or not you have Python installed in your machine run this on your terminal.

python --version

Expected Output:

Python 3.7.2

The version may vary until this returns the version of a Python release without any error, you are good to go. If this returns an error, then you have to install Python first.

Using Python 3.x+ is highly advised because Django 2.0+ is strictly for Python 3

  1. How To Install Python On Windows
  2. How To Install Python 3 on Mac OS

After Python Installation we need to install virtualenv (Optional Prerequisite), this is not a dependency of Django, but it is advised to create separate virtual environments for different projects. By using virtual environments, applications can run in their own ‘sandbox’ in isolation of other Python applications.

To know more about the virtual environment and their installation procedure read: How To A Create Virtual Environment for Python

Once we have Python and virtual environment are in place we can proceed to create virtual environments for Django Installation this is not necessary but is recommended.

Creating Virtual Environment for Django

For Windows

cd Desktop
virtualenv django
cd django

For Unix and Mac

mkdir django
cd django
python3 -m venv myenv
source django/bin/activate

Now your terminal should be prefixed with django, if not then go through the virtual environment guide again.

Once the virtual environment is activated, we can finally proceed to Install Django. We will use Pip package manager to install Django.

pip install Django

This will install the latest version of Django in our environment. keep patience It may take some time depending on your internet connection.

To install a specific version of Django you can specify it as follows.

 pip install Django==1.11

Verifying Django Installation

To verify the Django installation or to know the version of Django installed in your system execute this is terminal.

django-admin --version

This should return an official Django release version.


Now that installation is done, you may deactivate the environment.


RecommendedHow To Create A ‘Hello, World!’ Application With Django


Latest Articles

Latest from djangocentral

Django 4.1 adds async-compatible interface to QuerySet

The much-awaited pull request for an async-compatible interface to Queryset just got merged into the main branch of Django.Pull Request - The Django core team has been progressively adding async suppor…
Read more →

3 min read

Making Django Admin Jazzy With django-jazzmin

Django admin is undoubtedly one of the most useful apps of Django. Over the years there has been very little change in the admin app as far as the UX is concerned and it's not a bad thing at all. Django admin was designed to provide a simple and minimali…
Read more →

4 min read