How To Install Django



Django is a free, open-source program that streamlines Python programming to help developers create “clean, pragmatic design.”

Step One — Install Python and Pip

The virtual private server needs to be equipped with Python before Django can be installed. The recommended installation method is to create an isolated Python environment, called a virtualenv, where any changes made to the overall virtual server will not affect the Python projects. An additional benefit of using virtualenv is that it does not require root access to install or manage. Django itself can then be installed within the virtualenv with the help of Pip, a tool that makes installation, upgrades, and removals of Python Packages extremely easy.

You can install Pip on Ubuntu through apt-get:

  • sudo apt-get install python-pip

Go ahead and install Python:

  • curl -O https://raw.github.com/pypa/virtualenv/master/virtualenv.py

Once that process has completed, we need to create the new virtualenv.

  • python virtualenv.py example_env

The next step is to activate the virtualenv so that all further changes and installations will be done only within example_env

  • . example_env/bin/activate

Step Two — Install Django

In the previous step, we setup the environment to install Django. Now using the easy pip installer, we can get Django on our droplet.

  • pip install Django

For future reference, you can use these commands to make changes to your version of Django or any other Python packages:

  • pip install --upgrade Django
  • pip uninstall Django

You now have Django installed on your VPS!

Creative Commons License