How to install the Django Web Framework on Windows

For the windows enthusiast, you can install Django on windows. With some necessary skills in Windows PowerShell and Python, you can easily install Django on Windows.

Django is an extremely popular web framework written in python. It is an excellent aid to programmers worldwide. With its speed, security and its wealth of features, one can see why it is one of the leading authorities on web application development. To use it one needs a general knowledge of programming and installing it is relatively easy in windows. One of the prerequisites is Python, a python virtual environment and then Django s ready to be installed.

Special note: consult HostAdvice's  Best Python hosting and Best Django Hosting pages to find the leading web hosts in this category, including expert and user reviews.

Installing Python

Django is written in the Python language we require it installed. Download Python from >Here and get a version you prefer to use. If you already have version 3 and above, it is backwards compatible so no need to install the newest version.

Note: do not download version 2.7.x

For the purpose of this demonstration, the code used is for version 3 and above.

Choose the python version most suitable for your computer. Once downloaded, open the setup,

Installation window is displayed. Choose Customize installation and click next.

Tick all the boxes to make sure the components are installed.

Check the following boxes. Click >Install.

Setup is complete.

To verify if Python is on your system by using the PowerShell. Go to search type PowerShell Right click on it and choose run as administrator.

Update your PowerShell settings so it can run scripts, write the following code on PowerShell and press enter;

Set-ExecutionPolicy  Unrestricted

It prompts you, type y or yes.

Then type the following:

python  -V

It should show you the version currently installed on your system.

Installing a virtual environment

To install a virtual environment, type the following;

Pip  install virtualenv

To verify type;

Pip freeze

Creating a virtual environment

Create a folder called dev and navigate by typing;

mkdir dev
cd dev
ls
pwd

In the dev folder, create a new folder called newenv where our virtual environment will be stored.

mkdir newenv

Now change directory and go to that folder you created, referred as newenv here.

cd newenv

Then type

virtualenv .

the command to install the virtual environment.It is going to take some time. The virtual environment is set, activate it through your PowerShell by typing;

.\Scripts\activate

You notice that your prompt changes and start with the name of your virtual environment in brackets.

Verify, type;

pip freeze

Installing Django

Type the following command;

pip install django==1.11.5

Note that you can get whichever version of Django you want, only change the version number, e.g., ours is 1.11.5 you can get 1.11.6 if you would like.

Check version by typing

pip freeze

To leave your environment, just type the following command;

deactivate

To restart it again;

.\Scripts\activate

Conclusion

As you can see from the above guide, installing Django to the windows platform is very straightforward. You download the python programming tool, install the virtual environment and finally install Django. Get your web applications out of your mind and into the real world with Django on Windows.

 

Check out the top 3 Windows hosting services:

Was this article helpful?