Would you like to learn how to do a Django installation on Ubuntu Linux? In this tutorial, we are going to show you how to install, configure and access Django CMS on a computer running Ubuntu Linux.

• Ubuntu 18
• Ubuntu 19
• Django 2.2.6

Hardware List:

The following section presents the list of equipment used to create this Django tutorial.

Every piece of hardware listed above can be found at Amazon website.

Django Related Tutorial:

On this page, we offer quick access to a list of tutorials related to Django installation.

Tutorial Django – Installation on Ubuntu Linux

Upgrade your Ubuntu installation and reboot the computer.

Copy to Clipboard

Use apt-get to install the required packages.

Copy to Clipboard

Verify the default Python version installed on your system.

Copy to Clipboard

Verify the latest Python version installed on your system.

Copy to Clipboard

Change the default Python version to the Latest edition detected.

Copy to Clipboard

Verify the default Python version installed on your system.

Copy to Clipboard

Install Django.

Copy to Clipboard

Create your first Django project.

Copy to Clipboard

Verify the list of Django files created.

Copy to Clipboard

Here is an example.

Copy to Clipboard

You may use the tree command to verity the list of files and directories.

Copy to Clipboard

Edit the settings.py file

Copy to Clipboard

Locate the ALLOWED_HOSTS entry and configure your Django server IP address.

Copy to Clipboard

In our example, the Djando server is running on a computer using the IP address 192.168.15.11.

Start the Django server.

Copy to Clipboard

Open a browser software, enter the IP address of your Django server firewall plus :8000 and access web interface.

In our example, the following URL was entered in the Browser:

• https://192.168.15.11:8000

The Django web interface should be presented

Django web interface

On the Linux command-line, press CTRL+C to stop the Djando server.

Create the Django SQLite database schema.

Copy to Clipboard

Create the Administrative user account.

Copy to Clipboard

In our example, we create a user account named root with the password kamisama123.

Start the Django server.

Copy to Clipboard

Open your browser and enter the IP address of your web server plus :8000/admin

In our example, the following URL was entered in the Browser:

• http://192.168.15.11:8000/admin

On the login screen, use the Django username and password created before.

• Default Username: root
• Default Password: kamisama123

Django login

After a successful login, you will be sent to the Django Dashboard.

Django dashboard basic

Congratulations! You have finished the Django Installation on Ubuntu Linux.

Tutorial Django – CMS Installation on Ubuntu Linux

On the Linux command-line, press CTRL+C to stop the Djando server.

Install Django-CMS.

Copy to Clipboard

Edit your Django project settings.py file.

Copy to Clipboard

Locate the INSTALLED_APPS area.

Copy to Clipboard

Change your file’s INSTALLED_APPS area to look like mine.

Copy to Clipboard

Locate the LANGUAGE_CODE configuration.

Copy to Clipboard

Change the LANGUAGE_CODE configuration to English only.

Copy to Clipboard

Add a LANGUAGES section after the  LANGUAGE_CODE definition.

Copy to Clipboard

Add the following line at the end of your configuration file.

Copy to Clipboard

Start the Django server.

Copy to Clipboard

As an example, here is the content of our settings.py file.

Copy to Clipboard

On the Linux command-line, press CTRL+C to stop the Djando server.

Migrate the new configurations.

Copy to Clipboard

Start the Django server.

Copy to Clipboard

Open your browser and enter the IP address of your web server plus :8000/admin

In our example, the following URL was entered in the Browser:

• http://192.168.15.11:8000/admin

On the login screen, use the Django username and password created before.

• Default Username: root
• Default Password: kamisama123

Django login

After a successful login, you will be sent to the Django Dashboard with CMS installed.

Django Dashboard CMS

Congratulations! You have finished the Django CMS Installation on Ubuntu Linux.

Tutorial Django – MySQL Database Integration

On the Linux command-line, press CTRL+C to stop the Djando server.

Install the MySQL database service.

Copy to Clipboard

Use PIP to install the Mysqlclient package.

Copy to Clipboard

Access the MySQL database server.

Copy to Clipboard

Create a database named django.

Copy to Clipboard

Create a mysql user named django.

Copy to Clipboard

Give the MySQL user named django permission over the database named django.

Copy to Clipboard

Edit the /etc/mysql/my.cnf.

Insert the following information at the botton of this file.

Copy to Clipboard

Edit your Django project settings.py file.

Copy to Clipboard

Locate the DATABASES area.

Copy to Clipboard

Change your DATABASES area to look like mine.

Copy to Clipboard

You need to change the database name, username and password to reflect your environment.

Start the Django server.

Copy to Clipboard

On the Linux command-line, press CTRL+C to stop the Djando server.

Migrate the new configurations to MySQL.

Copy to Clipboard

As an example, here is the content of our settings.py file.

Copy to Clipboard

Create the Django Administrative user account.

Copy to Clipboard

Start the Django server.

Copy to Clipboard

Open your browser and enter the IP address of your web server plus :8000/admin

In our example, the following URL was entered in the Browser:

• http://192.168.15.11:8000/admin

On the login screen, use the Django username and password created before.

• Default Username: root
• Default Password: kamisama123

Django login

After a successful login, you will be sent to the Django Dashboard with CMS installed.

Django Dashboard CMS

Congratulations! You have finished the Django integration with MySQL on Ubuntu Linux.