Django is a Python framework used to build Dynamic modern day web applications. In this tutorial, I will show you how to install Django and Configure it on your Ubuntu Linux Desktop.

Setting Python3 as Default Python version

On my machine, I am running two versions of Python: version-2.7 the default version and version-3 to check the current version of Python just type the following command in your terminal.

$ python --version
How to Install and Configure Django Python Framework on Ubuntu
checking the Python version.

Now we have to change the default version from 2.7 to 3.0, type in the following commands to perform the action(root access needed).

$ update-alternatives --remove python /usr/bin/python2
$ update-alternatives --install /usr/bin/python python /usr/bin/python3 1

Now check again the python version.

$ python --version
How to Install and Configure Django Python Framework on Ubuntu
changing default Python version.

Installing Django using pip(Method-1)

pip is a python package management system, now we will install pip using the following apt command.

$ sudo apt-get install python3-pip

after pip installation, use the following command to download and install Django.

$ pip3 install django

After the installation is finished, verify it by using the following command.

$ django-admin --version
checking djnago version
checking Django version.

Installing the Django package(Method-2)

You can also install Django on your machine by installing the Django package using the following apt command.

$ sudo apt-get install python-django

Starting a new project in Django

Creating a new project in Django is a very simple job you can create a new project by using the following command:

$ django-admin startproject myproject

this will create the myproject directory having all Django files, the directory’s hierarchy is shown below.

Django project hierarchy
Django project hierarchy.

Now just go to the directory and run “”.

$ python runserver

if you run into the following error:

You have unapplied migrations; your app may not work properly until they are applied.
Run 'python migrate' to apply them.

just do the following:

$ python migrate

Now open your web browser and go to the following URL http://localhost:8000 if it shows the following page then you have followed everything correctly.

Django welcome page
Django welcome page

Now we need to create a superuser for accessing the project’s admin panel.

$ python createsuperuser

after typing the following command just fill up the details and remember it won’t show your password in the terminal while you were typing it, so don’t worry.

creating superuser in Django.
creating superuser in Django.

open your browser and go to http://localhost:8000/admin and log in with your superuser credentials.

Django Admin Panel
Django Admin Panel

Django tutorials for further learning:

If You Love
this article, You Should Consider:

  • Like us on Facebook
  • Follow us on Instagram
  • Follow us on Twitter
  • Let us know your suggestions and queries in the comments below.
  • Subscribe to our Newsletter

Thank you for your Love and Support