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.
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.
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.
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
cd Desktop virtualenv django cd django Scripts\activate.bat
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.
This should return an official Django release version.
Now that installation is done, you may deactivate the environment.