In this guide, we’ll walk you through the steps to install Django on Fedora. Django is a free and open-source, high-level Python web framework designed to encourage rapid development and clean, pragmatic design. Built by experienced developers, Django handles many of the common tasks in web development, allowing you to focus on building your application without reinventing the wheel.

There are two methods that you can use to install Django on Fedora.

  1. Install Django on Fedora with pip|pip3
  2. Install Django on Fedora by building from Git

Let’s look at how to use either of the methods to Install Django on Fedora.

Step 1: Install Python3 and Pip3

Your Fedora system should come with Python 3, if it doesn’t have it, install by running the commands below on your terminal.

sudo dnf -y install vim python3 python3-pip

Step 2: Install Django with pip3

The easiest and quickest method of installing Django on Fedora is with pip3.

Check your Python version

$ python3 -V
Python 3.13.2

Ensure pip3 is installed

$ sudo dnf -y install python3-pip
$ pip3 -V
pip 24.3.1 from /usr/lib/python3.13/site-packages/pip (python 3.13)

Once installed, Download and install Django on Fedora with it.

pip3 install --user Django

Installation output:

Collecting Django
  Downloading django-5.2.1-py3-none-any.whl.metadata (4.1 kB)
Collecting asgiref>=3.8.1 (from Django)
  Downloading asgiref-3.8.1-py3-none-any.whl.metadata (9.3 kB)
Collecting sqlparse>=0.3.1 (from Django)
  Downloading sqlparse-0.5.3-py3-none-any.whl.metadata (3.9 kB)
Downloading django-5.2.1-py3-none-any.whl (8.3 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.3/8.3 MB 83.6 MB/s eta 0:00:00
Downloading asgiref-3.8.1-py3-none-any.whl (23 kB)
Downloading sqlparse-0.5.3-py3-none-any.whl (44 kB)
Installing collected packages: sqlparse, asgiref, Django
Successfully installed Django-5.2.1 asgiref-3.8.1 sqlparse-0.5.3

The installation of Django will give you django-admin command to manage Projects,

$ which django-admin
~/.local/bin/django-admin

Check django-admin version using:

$ django-admin --version
5.2.1

Install Django on Fedora from Git source code

You can also install Django from source code. Make sure you have Git installed:

sudo dnf -y install git

Check out Django’s main development branch like so:

git clone https://github.com/django/django.git

This will create a directory django in your current directory. Next is to make Django’s code importable and django-admin utility command available:

pip3 install -e django/

Step 3: Create a test Django Application

Create a Django test application by running

mkdir projects
cd projects
django-admin startproject test_app
cd test_app

test_app is the name of our Django Project.

Apply pending migrations

$ python3 manage.py migrate
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying sessions.0001_initial... OK

Step 4: Create an Admin Account

Create a Django project superuser account by running the following commands from your Django application directory.

$ python3 manage.py createsuperuser
Username (leave blank to use 'jmutai'): admin
Email address: [email protected]
Password: <INPUT-PASSWORD>
Password (again): <RE-ENTER-PASSWORD>
Superuser created successfully.

Input your admin username, email address, and password.

Step 5: Allow external access (Optional)

Note that by default Django doesn’t allow external access to the application, you need to explicitly define an ACL.

vim test_app/settings.py

Edit the lineALLOWED_HOSTS to whitelist your Computer IP or LAN subnet.

ALLOWED_HOSTS = ['192.168.18.23']

You can now  start Django application server:

$ python3 manage.py runserver 0.0.0.0:8090
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
November 04, 2021 - 21:40:16
Django version 3.2.9, using settings 'test_app.settings'
Starting development server at http://0.0.0.0:8090/
Quit the server with CONTROL-C.

If you open the URL http://[server IP/hostname]:8090 you should see a successful message like below:

install django fedora 29 fedora 28

Django Administration page is available on :8090/admin

install django fedora 29 fedora 28 admin page

Login with created username and password:

install django fedora 29 fedora 28 admin page 02

The admin page allows you to add other users, add groups, change password e.t.c. It looks like below:

install django fedora 29 fedora 28 admin page 02 1

Enjoy writing your Web application with Django Framework on Fedora. Don’t forget to check other Fedora articles available on our website.

LEAVE A REPLY

Please enter your comment!
Please enter your name here