How To Install Django On Windows With Ease

Moses Ogbopina
May 2, 2019 · 4 min read
Image for post
Image for post

What 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 Development
  • It is Full Featured
  • High Performace
  • Very Secure
  • Very Scalable

Many 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:

…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.

Python Oficial Website

You will download a python executable file while installing ensure to enable the “Add Python 3.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 --version

You should see the version of Python running on Your System, in my case its

Python 3.7.3

You can also check the version of pip you are using by running the command

pip --version

pip 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 Environment

Virtual 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:\Users\Pena\Projects>

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

pip install virtualenvwrapper-win

After installing virtualenvwrapper successful, you should see something like the image below

Image for post
Image for post

Now unto the creation of a Virtual Environment, where you will be creating your Django applications. And to do this, run the command

mkvirtualenv <<any name of your Choice>>

Use any name of your choice

Image for post
Image for post

I 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 command

deactivate

and 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 Django

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

pip install django

and running the code, you should see something that looks like the image below

Image for post
Image for post

Hurray.. you have successfully installed Django on your Windows PC.

Bonus

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

To create a Django Project run the command

django-admin startproject <<project name>>

a directory with Your Project name will be created. cd into the directory and run the command

python manage.py runserver

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

Image for post
Image for post

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

BitHubPH

Sharing fun and hands-on training with code base on github.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store