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.
Use apt-get to install the required packages.
Verify the default Python version installed on your system.
Verify the latest Python version installed on your system.
Change the default Python version to the Latest edition detected.
Verify the default Python version installed on your system.
Install Django.
Create your first Django project.
Verify the list of Django files created.
Here is an example.
You may use the tree command to verity the list of files and directories.
Edit the settings.py file
Locate the ALLOWED_HOSTS entry and configure your Django server IP address.
In our example, the Djando server is running on a computer using the IP address 192.168.15.11.
Start the Django server.
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
On the Linux command-line, press CTRL+C to stop the Djando server.
Create the Django SQLite database schema.
Create the Administrative user account.
In our example, we create a user account named root with the password kamisama123.
Start the Django server.
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
After a successful login, you will be sent to the Django Dashboard.
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.
Edit your Django project settings.py file.
Locate the INSTALLED_APPS area.
Change your file’s INSTALLED_APPS area to look like mine.
Locate the LANGUAGE_CODE configuration.
Change the LANGUAGE_CODE configuration to English only.
Add a LANGUAGES section after the LANGUAGE_CODE definition.
Add the following line at the end of your configuration file.
Start the Django server.
As an example, here is the content of our settings.py file.
On the Linux command-line, press CTRL+C to stop the Djando server.
Migrate the new configurations.
Start the Django server.
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
After a successful login, you will be sent to the Django Dashboard with CMS installed.
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.
Use PIP to install the Mysqlclient package.
Access the MySQL database server.
Create a database named django.
Create a mysql user named django.
Give the MySQL user named django permission over the database named django.
Edit the /etc/mysql/my.cnf.
Insert the following information at the botton of this file.
Edit your Django project settings.py file.
Locate the DATABASES area.
Change your DATABASES area to look like mine.
You need to change the database name, username and password to reflect your environment.
Start the Django server.
On the Linux command-line, press CTRL+C to stop the Djando server.
Migrate the new configurations to MySQL.
As an example, here is the content of our settings.py file.
Create the Django Administrative user account.
Start the Django server.
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
After a successful login, you will be sent to the Django Dashboard with CMS installed.
Congratulations! You have finished the Django integration with MySQL on Ubuntu Linux.