How To Install python-djangorestframework on Ubuntu 18.04

In this tutorial we learn how to install python-djangorestframework on Ubuntu 18.04. python-djangorestframework is Web APIs for Django, made easy

Introduction

In this tutorial we learn how to install python-djangorestframework on Ubuntu 18.04.

What is python-djangorestframework

python-djangorestframework is:

powerful and flexible toolkit that makes it easy to build Web APIs. Some reasons you might want to use REST framework:

  • The Web browseable API is a huge useability win for your developers.
  • Authentication policies including OAuth1a and OAuth2 out of the box.
  • Serialization that supports both ORM and non-ORM data sources.
  • Customizable all the way down - just use regular function-based views if you don’t need the more powerful features.
  • Extensive documentation, and great community support.

There are three methods to install python-djangorestframework on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install python-djangorestframework Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install python-djangorestframework using apt-get by running the following command:

sudo apt-get -y install python-djangorestframework

Install python-djangorestframework Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install python-djangorestframework using apt by running the following command:

sudo apt -y install python-djangorestframework

Install python-djangorestframework Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install python-djangorestframework using aptitude by running the following command:

sudo aptitude -y install python-djangorestframework

How To Uninstall python-djangorestframework on Ubuntu 18.04

To uninstall only the python-djangorestframework package we can use the following command:

sudo apt-get remove python-djangorestframework

Uninstall python-djangorestframework And Its Dependencies

To uninstall python-djangorestframework and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove python-djangorestframework

Remove python-djangorestframework Configurations and Data

To remove python-djangorestframework configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge python-djangorestframework

Remove python-djangorestframework configuration, data, and all of its dependencies

We can use the following command to remove python-djangorestframework configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge python-djangorestframework

References

Summary

In this tutorial we learn how to install python-djangorestframework package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.