How To Install Django On Windows With Ease

How To Install Django On Windows With Easemoses ogbopinaBlockedUnblockFollowFollowingMay 2What is Django?Django is an Open Source High-Level Python Web Framework that encourages rapid development.

It is referred to as “the web framework for Perfectionist with a deadline” because it was designed to help developers take applications from concept to completion as quickly as possible.

Why Use Django.

Some of the features of Django that makes it amazing include:It Supports Rapid DevelopmentIt is Full FeaturedHigh PerformaceVery SecureVery ScalableMany Popular Web Applications use/used Django for its development (Note that for some of these applications, Django is heavily customized), some of these sites include:DisqusInstagramPinterestNasa…and the list goes on and on and on.

Now let’s jump into setting up Django for Your Windows PC.

Install Python.

Before we can install Django we first have to install the latest version of Python which as of the time of this writing is 3.

7.

3 so lets head over to the official Python website and download the latest version of Python.

7 to PATH” option and click on install, wait a few minutes and the installation will be finished.

Now let’s check to make sure our installation was successful.

Open up your Command Prompt and run the following command.

python –versionYou should see the version of Python running on Your System, in my case itsPython 3.

7.

3You can also check the version of pip you are using by running the commandpip –versionpip is a Package manager for Python similar to npm for JavaScript, we will be using pip to install Django and the other packages needed to develop our Applications.

Install Virtual EnvironmentVirtual Environment in python is an isolated working copy of python, it creates a virtual environment for your python instances and is the recommended way to develop Django applications.

Now we are going to create a virtual environment for Django, and to do this we will navigate to the directory we want to install it in using the “cd” command in our Command Prompt.

C:UsersPenaProjects>Now to install Virtual Env, run the command and make sure you have a working internet Connection.

pip install virtualenvwrapper-winAfter installing virtualenvwrapper successful, you should see something like the image belowNow unto the creation of a Virtual Environment, where you will be creating your Django applications.

And to do this, run the commandmkvirtualenv <<any name of your Choice>>Use any name of your choiceI used the name py37 for my virtual env, and you can see it been attached to my current directory, this indicates that the virtual environment py37 is currently active.

If I wanted to deactivate the virtual environment I have to run the commanddeactivateand if I wanted to Activate my virtual environment all I have to do is ….

you guessed it…workon <<virtualenv name>>So we have our Python installed, our Virtual Environment Up and Running, and its time to jump into the main dish.

Install DjangoTo install Django, make sure you are in the Virtual Environment you created, and run the following code.

pip install djangoand running the code, you should see something that looks like the image belowHurray.

you have successfully installed Django on your Windows PC.

BonusAs a little extra we will set up a Django Project to see how all this turned out.

To create a Django Project run the commanddjango-admin startproject <<project name>>a directory with Your Project name will be created.

cd into the directory and run the commandpython manage.

py runserverCopy the development server URL that was generated and paste that into your browser, you should see the Django welcome page.

If you made it to this point, congratulations on successfully installing Django.

If you are a beginner in Django and you are looking for where to start this journey you have decided to embark on.

There are lots of great beginner tutorials including the Django documentation, Django Girls is another great resource for getting started with Django.

Thank You for reading and do not hesitate to give me some feedback to improve my future articles in the comment below.. More details