In this tutorial, we will show you how to install Django on Fedora 36
Django is a Python-based web framework, free and open-source, that follows the model–template–views (MTV) architectural pattern. It is maintained by the Django Software Foundation (DSF), an independent organization established in the US as a non-profit.
Django is a free and open-source high-level Python Web framework built by experienced developers to encourage rapid development and pragmatic design of web applications for programmers and developers.
Install Django on Fedora 36
Follow the steps below to get start with Django
- Update your system package as follows
sudo dnf upgrade -y && sudo dnf update -y
- Install Python3 and pip3 as follows:
sudo dnf install python3 python3-pip -y
- Verify Python and PiP installation by running the commands below:
python3 -V pip3 -V
- Install Django using pip3 as shown below:
pip3 install Django
- You will get a django-admin command for creating new projects. Check the current installed version:
- Next, create a Django test application by following the commands below:
mkdir unixcop-project cd unixcop-project/ django-admin startproject unixcop cd unixcop/ python3 manage.py migrate
Then create a superuser account for the administration of the Django application. Run the following command from your Django application directory.
python3 manage.py createsuperuser
Enter the Username, Email address and password as shown below:
- Finally, run the Django application server with the below command.
python3 manage.py runserver 0.0.0.0:8000
The 0.0.0.0:8000 defined that Django will listen on all interfaces on port 8000. You can change this port with any of your choices.
- Configure Firewall, in order to allow access to port 8000, you need to modify firewall rules in a new SSH connection:
firewall-cmd --add-port=8000/tcp --zone=public --permanent firewall-cmd --reload
- The Django application server is running now. Open your web browser and access to Django system IP on port 8000. You will be directed to the default Django web page.
http://IP_Address:8000 OR http://localhost:8000
In this tutorial, We showed you how to install Django in Fedora 35/36.
Nice, but how i can start a service so i can use django in production ?