Skip to content
Follow
Ubuntu Linux

How to Install Django 5 on Ubuntu 24.04

Richard
Written by
Richard
Mar 16, 2025 Updated Sep 15, 2026 3 min read
How to Install Django 5 on Ubuntu 24.04
How to Install Django 5 on Ubuntu 24.04

Django 5 on Ubuntu 24.04 is a web framework for Python that handles database connections and page routing so you can build websites faster. Python version 3.12 comes built into Ubuntu 24.04, which makes the setup process fast and straightforward.

Advertisement

Before you install Django 5, you need to create a private workspace called a virtual environment using the built-in venv tool. This keeps your project files separate from the rest of your operating system.

⚡ Quick Answer

Install Django 5 on Ubuntu 24.04 by first installing Python 3.12 and python3.12-venv. Then, create and activate a virtual environment with `python3 -m venv ~/django5` and `source ~/django5/bin/activate`. Finally, install Django using `pip3 install ‘Django>=5,

Advertisement

Install Python

Django is a Python framework that requires Python to be installed. If you haven’t done so yet, use the command below to install Python.

sudo apt update
sudo apt install python3.12 python3.12-venv

After installing , you can check the Python version using the command below.

python3 -V

Install Django 5

To install Django 5 on Ubuntu 24.04, you need to create a virtual environment to keep your project files separate from the rest of your system. Once the virtual environment is ready and active, use the pip package manager to download and set up Django 5 on your machine by running the installation command in your terminal.

Within your home directory, run the command below to create a Python environment and download Django 5 packages.

Advertisement
python3 -m venv --system-site-packages ~/django5

Then, activate the environment.

source ~/django5/bin/activate

Install Django 5.

pip3 install 'Django>=5,<6'

You can check the Django version after installing using the command below.

django-admin --version
⚠️WarningWhen you finish with the virtual environment, run the command below to exit it.
Advertisement
deactivate

Create your project

Creating your first Django 5 project involves using the django-admin command-line tool to generate the essential file structure and configuration settings for your website. After activating your virtual environment, you run a simple command to set up the project folder and prepare the default database so you can start building right away.

Activate the Django 5 environment.

source ~/django5/bin/activate

Create an app folder called myproject.

django-admin startproject myproject

Change into the myproject folder.

Advertisement
cd myproject

Configure a database. Default is SQLite.

python manage.py migrate

Create an admin user.

python manage.py createsuperuser

When prompted, enter a username, password, and email address.

Username (leave blank to use 'richard'):      
Email address: richard@example.com
Password:
Password (again):
Superuser created successfully.

You can now start the project using the command below.

Advertisement
python manage.py runserver 0.0.0.0:8000
⚠️WarningOpen your browser and browse to the localhost name, followed by port 8000 to see the Django default web portal.
http://localhost:8000
Django web portal
Django web portal

To access the Django from another machine, edit the networking settings.

vi myproject/settings.py

Then, add this line

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['*']

Save and exit.

Advertisement

Within your project folder, you can start creating your apps.

That should do it!

Conclusion:

In summary, installing Django on Ubuntu 24.04 using a Python virtual environment is a straightforward process that provides a clean workspace for your projects. Here are the key takeaways:

  • Django Framework: Enables rapid development and follows the DRY principle for efficient coding.
  • Virtual Environment: Keeps your project's dependencies isolated, avoiding conflicts with global Python installations.
  • Installation Steps: Installing Python and setting up Django in a virtual environment is simple and manageable.
  • Creating Your First App: You can quickly start developing your first app with the provided commands and configurations.
  • Accessing Your Project: Adjust network settings to access your Django application from other machines.

This guide helps you start developing with Django, a web framework that provides powerful features for your web applications. Using Django enables faster and more efficient project creation.

' to permit access from any host."]

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

Advertisement

📚 Related Tutorials

How to Install Python on Ubuntu Linux
Ubuntu Linux How to Install Python on Ubuntu Linux
How to Install GNOME Desktop on Ubuntu 24.04
Ubuntu Linux How to Install GNOME Desktop on Ubuntu 24.04
How to Install KDE Desktop on Ubuntu 24.04
Ubuntu Linux How to Install KDE Desktop on Ubuntu 24.04

No comments yet — be the first to share your thoughts!

Leave a Comment

Your email address will not be published. Required fields are marked *