Support Our Site

To ensure we can continue delivering content and maintaining a free platform for all users, we kindly request that you disable your adblocker. Your contribution greatly supports our site's growth and development.

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==4.2

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

How to Use Subquery() in Django With Practical Examples

In the realm of web development, Django stands as a powerful and versatile framework for building robust applications. One of the key aspects of developing efficient and optimized web applications is handling database queries effectively. In this article…
Read more →

4 min read

DRF Serializer: Handling OrderedDict and Converting It to a Dictionary or JSON

In Django Rest Framework (DRF) tests, when you access, you might encounter an OrderedDict instead of a regular dictionary. This behavior is intentional and reflects the design of DRF's serialization process.Understanding the Problem The u…
Read more →

3 min read

Django Rest Framework CheetSheet: Mastering API Development

Django Rest Framework (DRF) is a powerful toolkit that makes building robust and scalable web APIs with Django a breeze. Whether you're a seasoned Django developer or a newcomer, having a comprehensive cheat sheet at your disposal can be a game-changer. …
Read more →

5 min read

How to Perform NOT Queries in Django ORM

In Django, performing NOT queries allows you to exclude certain records from the query results based on specific conditions. The NOT operator, represented by the tilde (~) when used in conjunction with the Django ORM's Q object, helps you construct compl…
Read more →

3 min read