Django is a free and open source high-level Python web framework written in Python programming language that helps developers build complex web applications easily and quickly.With the help of Django Developers can built web application more quickly with less code and in easy manner.
Initial Set Up
Before using Django we have to install it first. Being a Python Web framework, Django requires Python.
This tutorial will help you to a simple, minimal installation.
You have to check your python version that goes along with Django. for details. Python includes a lightweight database called SQLlite so you won’t need to set up a database just yet.
You can get the latest version of Python at https://www.python.org/download/ or with your operating system’s package manager.
To check the version of python Simply type python in shell,which will give you something like this
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
Before instantiating Django, we need to equip the server with Python. The common method of installation is by creating an isolated Python environment called virtualenv.
Virtualenv will make sure that the python projects will not be affected by the changes made to the overall virtual server. Also, Virtualenv doesn’t require root access for installation or maintenance .
Now, we can install Django using Pip. Pip is a tool/moudle used for installing, upgrading and removing python packages easily. Here, in this tutorial since we are using Ubuntu, Pip is installed through apt-get as given below:
sudo apt-get install python-pip
Now, for installing Python, use the command below:
curl -O https://raw.github.com/pypa/virtualenv/master/virtualenv.py
To create a new virtualenv named example_env
python virtualenv.py example_env
Once it is done, you have to activate the virtualenv to make sure all the changes and installations will only be done within that environment. Here I am using the name example_env. You can replace with the newly created virtualenv.
Finally, its time to install Django. we can easily install Django using Pip tool as given below:
pip install Django
Django will be installed on your droplet.
If you need to upgrade the Django to newer version or remove the Django
pip install –upgrade Django
To remove the Django
pip uninstall Django