How to Install Django on Ubuntu 16.04

r00t September 11, 2017

Install Django on Ubuntu 16.04

In this tutorial we’ll learn how to install Django on Ubuntu 16.04. We will also install and configure its prerequisites. Django is a popular Web framework for writing web applications. With Django you can build faster and scalable applications, without writing the code from scratch (without reinventing the wheel). Web framework was designed to aid programmes to create applications. These web frameworks are the core and takes care of functionalities like user session management, database connectivity etc.

I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an Ubuntu 16.04 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.

Install Django on Ubuntu 16.04

Step 1. First, ensure your system and apt package lists are fully up-to-date by running the following:

apt-get update -y && apt-get upgrade -y

Step 2. Installing pip and necessary dependencies.

Use the commands below to install the latest version of python pip:

apt-get install python3-pip

Check if pip is successfully installed:

# pip3 -V
pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.5)

Step 3. Installing Djanggo.

Install Django globally using the following command:

pip3 install django

To verify the Django version, run:

django-admin --version

Step 5. Create your first Django project.

Now that the Django framework has been installed, you can to give it a test drive by creating a sample project:

cd ~
django-admin startproject bmw1

The command above will create a directory bmw1 in your working directory ~, and store all necessary files within.

Run the commands below in sequence to get your application started:

cd bmw1/
python3 manage.py migrate
python3 manage.py createsuperuser
python3 manage.py runserver 0.0.0.0:8000

Step 6. Accessing Django Web Installation.

Now you can access the Django web install wizard in your browser by entering the domain name port 8000 or http://your_ip/8000 to continue your Django installation.

Install Django on Ubuntu 16.04

You can also access the Django admin page by typing the URL server_IP_addr:8080/admin on your web browser:

Install Django on Ubuntu 16.04

Congratulation’s! You have successfully install and configured Django on your Ubuntu 16.04 LTS server. Thanks for using this tutorial for installing Django on Ubuntu 16.04 system.

The Tags:

Leave a Comment

Comments are closed.