Tuesday, 5 December 2017

How to Install and Setup Python With Django - Very Easy!

In this tutorial, I will teach you an easy way to set up Python and Django on Window.

With Python, you can write and run Python programs

What is Django?
Django is a Web Framework. This means that it is a collection of tools/scripts that helps you create web application(application that run on the web)

What You Would Need
  1. Python Installer: You can download this from the Python website
  2. Script ez_setup.py: Used to install Setuptools. Download it from here
  3. Script get-pip.py: Used to install additional tools to Python. You can get it from here.
  4. Django zip package
I would suggest you download this four items and put them in a folder. In this lesson, the Python 2.7.x

Install Python
Follow the procedure below carefully to install Python on your system
  • Run the Python msi installer. Make sure it installs in your drive C. 
  • Check that a Python folder have been created on your drive C (if you can't do this let me know in the comment box below)

Verify Environment variable
Check that the path to the executable has been added to the environment variable. I think it should be added when Python is installed.

Test the Installation
  • Open the command prompt
  • Type python -v
If is displays the version of Python installed, then the installation was successful.

Install Setuptools
  • Copy the ez_setup.py script to your drive C
  • Open the command prompt
  • Change the directory to the  folder containing the ez_setup.py. If you placed  it in drive C, then you need to type, C:\ and press enter.
  • Run the Script. Just type python ez_setup.py
If there is any prompt during the installation you can respond to it.

Install pip (your computer should have internet connection to do this)
  • Copy the get-pip.py script to your drive C
  • Open the command prompt
  • Change the directory to the  folder containing the get-pip.py. If you placed  it in drive C, then you need to type, C:\ and press enter.
  • Run the Script. Just type python get-pip.py
If there is any prompt during the installation you can respond to it.

Install Django
  • Unzip the Django zip package
  • Place the Django folder in your drive c
  • Open the command prompt
  • Change the directory to the folder containing Django
  • Run the command python setup.py build
  • Wait for some time for the installation to complete.
If there is any prompt during the installation you can respond to it.

Test your Installation 
  • Open the Python shell
  • Type python
If it displays the version of python installed, then the python installation was successful
  • Type import django and press enter
  • Type print (django.get_version()) and press enter
If it displays the version of Django installed, then know that the installation was successful. At this point, you are ready to start building websites or web applications in Python.
In the subsequent tutorials, we would learn how to setup a database in Python and how to create our first website in python

Any Issues?
If you had any issues with the procedure, let me know in the comment box below. I normally answer to student's challenges before I post the next lesson.