Django is a free, open-source web framework written in the most popular python programming language and used by millions of developers every year. Its popularity is due to its friendliness to both beginners and advanced programmers with lots of python libraries and support.
In this tutorial, you’ll learn how to install Django on Windows Operating System. This tutorial can be used by Windows 7, 8, 8.1 and 10 users. With the following tutorial, you will install Python, Pip, Virtualenv, and Django on your system. We will use Virtual Environment to install Django and its libraries.
Install Python and Pip
Download the Python Web Installer from Stable Release – here
Open the setup file of Python which we have downloaded. Double click on that file and follow the steps in Images.:
- Check the box for Add Python 3.7 to PATH for accessing python from the command line.
- Customize installation: Remove features that can be used by Python Frameworks (I recommend let it be the default).
- Click on Install Now for installing and give permissions
Verify if Python and Pip is installed, by typing the below commands –
python --version pip --version
Learn Python Programming Language.
Install Virtual Environment
After installing Python, now we need to install VirtualEnv for creating Python Environment for your Django Project.
Open Command Line or Windows Powershell and type bellow command –
pip install virtualenv env
Once virtualenv is installed, you need to Activate it. For Activating Virtual Environment type –
Install Django on Windows
After activating the Virtual Environment, we will install Django inside it.
pip install django
Note – Django is installed in your virtualenv locally.
Example – Create A Django Project
Now we have installed everything that we need to create a Django Project. So let’s create one. In your project folder type –
django-admin startproject example .
That’s it, Now run the server
python manage.py runserver
And Go to http://localhost:8000/
Note – For Deactivating Virtualenv type
deactivate in your terminal.