Introduction to Django

What is Django?

Django is a free and open source web application framework written in Python that encourages rapid development and clean, pragmatic design. Django follows the model-view-template architectural pattern. Django offers a big collection of modules which you can use in your own projects. Primarily, frameworks exist to save developers a lot of wasted time and headaches and Django is no different.

From the official site ,

With Django, you can take Web applications from concept to launch in a matter of hours. Django takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel. It’s free and open source.

Ridiculously fast.

Django was designed to help developers take applications from concept to completion as quickly as possible.

Fully loaded.

Django includes dozens of extras you can use to handle common Web development tasks. Django takes care of user authentication, content administration, site maps, RSS feeds, and many more tasks — right out of the box.

Reassuringly secure.

Django takes security seriously and helps developers avoid many common security mistakes, such as SQL injection, cross-site scripting, cross-site request forgery and clickjacking. Its user authentication system provides a secure way to manage user accounts and passwords.

Exceedingly scalable.

Some of the busiest sites on the planet use Django’s ability to quickly and flexibly scale to meet the heaviest traffic demands.

Incredibly versatile.

Companies, organizations and governments have used Django to build all sorts of things — from content management systems to social networks to scientific computing platforms.

Now , Next thing is installation of Django

Step 1. Install python

Download it from https://www.python.org/downloads/ , See at below pic

img1

Step 2. Set Environmental variable

Open system properties from controlpanel > System > Advance system settings , you can set here environment variables

img4

click Environment Variables ,Select path variable and then click on Edit button . Now here we set path for python by entering 3 values first one is path of your python folder , in my case it is C:\Program Files\Python35. Next value is path of python.exe  C:\Program Files\Python35\python.exe. Now you can check it from cmd prompt . Open cmd prompt and type python then press enter key.

img5

Here you can see the version of installed python software in your PC.Since python software is working now  you can work on the same but our main objective is to install django so we have to set some more environment variable . Next value of Path variable is C:\Program Files\Python35\Scripts\  and C:\Program Files\Python35\Lib\site-packages\django\bin. Each value is separated by “;”.

Step 3. Install pip(python installer package)

Download it from http://pip.readthedocs.io/en/stable/installing/#installing-with-get-pip-py. 

img2

Here you can see get-pip.py link , right click on this link and click save link as and then save it on a location let us assume that we stored it in desktop.Now right click on downloaded pip file and select properties , following popup will come where you can check opens with .

img3

If opens with is not python then change it to python. Now open a cmd prompt and moved into desktop location since our pip file is there the enter command Python get-pip.py and press enter key

img6

Now pip is installed in your PC , you can check it by command PIP just enter pip command press enter you can see some pip stuff as shown below

img7

Step 5. Set virual environment

open cmd prompt ,type PIP freeze press enter then type pip install virtualenv and press enter.Now virtual environment is installed in your PC , Next step is to create a virtual environment and for doing so, type  virtualenv venv command.

img8

it create a folder with name venv in your desktop. Now next thing is to activate virtual environment and for doing so move inside venv folder and type .\Scripts\activate

img9

it actiavtes your virtual environment and now from this virtual environment enter pip install django which will installed your django software.

Thanks

Leave a comment