How to Install or Upgrade Django Using Pip

How to Install or Upgrade Django Using Pip

Spread the love

We will show you how to install or upgrade Django using pip on a Linux VPS. Django is a free and open-source web framework based on Python and follows the model-view-template (MVC) architectural pattern. Django is build by experienced web developers and encourages rapid development and clean, pragmatic design. Using Django, you can develop full fledged database-driven websites in Python. The framework takes care of advanced tasks like user authentication, content administration, sitemaps etc. Moreover, you can use clean and elegant URL scheme for your web application. Django is one of the most popular web server frameworks and in this tutorial we are going to show you how to install or upgrade Django using pip on a Linux VPS.

Prerequisites for Django

Django requires Python, so in order to be able to run Django on your server, you need to install Python on your server. Python 3 is recommended. Also, you can use MySQL/MariaDB, PostgreSQL or SQLite as a database engine along with Django to store the data.

Connect to your Linux server via SSH

To install or update Django using pip you need to have SSH access to the server. Connect to your server via SSH and make sure you have Python installed on your server:

python -V

Or if you are willing to use Python 3 for your Django project

python3 -V

Install Django on a Linux VPS

First of all, you have to install pip on your server. To install pip on an Ubuntu 16.04 VPS, run the following commands:

apt-get update
apt-get install python3-pip

CentOS 7 comes with Python 3.4 by default, so to install pip on CentOS 7 VPS, run the following command:

yum install python34-pip

In case you already have pip installed on your Linux server, you can upgrade it using the following commands:

On Ubuntu 16.04, run the following command:

pip3 install --upgrade pip

On CentOS 7, run the following command:

pip3.4 install --upgrade pip

Next step is to install and set up the Python Django package:

On Ubuntu 16.04, run the following command:

pip3 install django

On CentOS 7, run the following command:

pip3.4 install django

Now you have the Django package installed on your server. You can start a new Django project using the django-admin command. For example:

django-admin startproject newapp

The command will generate new Django application called newapp which you can use for your next project. For more information about how to get started with Django it is recommended to refer to the official Django documentation.

Update Django using pip on a Linux VPS

First, you should determine the Django version which is currently installed on your server.

On Ubuntu 16.04, run the following command:

pip3 list | grep -i django

On CentOS 7, run the following command:

pip3.4 list | grep -i django

If you want to update the Django package using pip on your Linux server you can use the following commands:

On Ubuntu 16.04:

pip3 install --upgrade django

On CentOS 7:

pip3.4 install --upgrade django

Also, pip allows you to install specific Django version. You can do so by specifying the Django version while installing/upgrading the package. For example, to install Django 1.11.12 which is the latest release from the 1.11 LTS release, you can do the following:

On Ubuntu 16.04, run the following command:

pip3 install django==1.11.12

or if you are upgrading to that version, run the following command:

pip3 install --upgrade django==1.11.12

On CentOS 7, run the following command:

pip3.4 install django==1.11.12

or if you are upgrading to that version, run the following command:

pip3.4 install --upgrade django==1.11.12

As you can see, installing and upgrading Django using pip on a Linux server is a very easy task. You have to install Python and pip on the server and then install the Django package which will allow you to use the django-admin command to start new Django projects. If you wish to uninstall the Django package completely, you can use the following commands:

On Ubuntu 16.04, run the following command:

pip3 uninstall django

On CentOS 7, run the following command:

pip3.4 uninstall django

This will not remove any of your existing projects. It will only remove the Django package installed by pip.

Of course, you don’t have to install or upgrade Django using pip on a Linux VPS, if you use one of our Linux Support Services, in which case you can simply ask our expert Linux admins to install or upgrade Django using pip for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post on how to install or upgrade Django using pip on a Linux VPS, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *