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.
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.
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.
You should see the version of Python running on Your System, in my case its
You can also check the version of pip you are using by running the command
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.
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
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
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
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.
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
Hurray.. you have successfully installed Django on your Windows PC.
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.
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