How to Install Django on Ubuntu

Django is an Open-Source application framework written in  Python. A framework is a collection of modules to make development easier. It encourages rapid development and clean, pragmatic design.

In this tutorial, we will learn to install Django on Ubuntu.

 

Also Read: How to Install Mongodb on Ubuntu

&&  How to install Anaconda on Linux

 

Install Django on Ubuntu

 

We can install Django in three ways:

1) Install Django using Apt manager

2) Install Django using PIP

3) Install Django using Git hub.

 

Install Django using Apt Manager

 

Using Apt Manager you can install the Django framework from default Ubuntu Package Manager.

   $ sudo apt-get install python3-django

 If you want to install, Django 2 (however this is not recommended, as support is no longer available) use the following command.

  $ sudo apt-get install python-django

  It will install a stable version of Django on your Linux box.

Install Django using PIP

 

First, Install PIP  by using the following command

  $ sudo apt-get install python3-pip

Now install Django using PIP

   $ pip3 install django

It will also install a stable version of Django on your Linux box.

Install Django using Github

Use this method if you want to install a development version rather than a stable Version. To install Django from Github you must install PIP and Git both first. Please follow the following commands to install Django from Github.

 

$ sudo apt-get install python3-pip

$ sudo apt-get install git

Now clone the Django repository to your local

Create a folder namely django_repo in your home directory.

$ mkdir ~/django_repo

 change directory to django_repo.

$ cd ~/django_repo

Now clone the Django repository to your local

$ git clone git://github.com/django/django

Install Virtualenv to create virtual environment

$sudo apt install virtualenv -y

Create and activate Virual Environment.

 $ virtualenv venv

 $ source ./venv/bin/activate

Now install the Django using PIP command.

$ pip install -e ~/django_repo

The above command installs Django on your system.

I hope you enjoyed this tutorial and learned how to Install Django on Ubuntu in different ways. If you think this is helpful, please do share this post with others. Please also share your valuable feedback, comment or any query in the comment box. I will really happy to resolve your all queries.

Thank You

If you think we helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter

You may also like…

Leave a Reply

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