Updated: 18 November 2026 · Applies to: Ubuntu 24.04, Debian 12, AlmaLinux 9 and Rocky Linux 9

Django is a Python web framework. Install it in a virtual environment and create a first project.

The operating system versions in the original guide (CentOS 7, Ubuntu 16.04/18.04, Debian 8/9) are no longer supported, so this guide uses Ubuntu 24.04, Debian 12, AlmaLinux 9 and Rocky Linux 9.

Install

apt install python3-venv python3-pip                  # Ubuntu / Debian
dnf install python3.12 python3.12-pip                  # AlmaLinux / Rocky (then use python3.12 below)
mkdir -p /srv/mysite && cd /srv/mysite
python3 -m venv venv && source venv/bin/activate
pip install django

Note: Django 6.1 (the current version) needs Python 3.12 or newer. Ubuntu 24.04 has Python 3.12. On AlmaLinux 9 / Rocky Linux 9 install python3.12 as shown (the default Python 3.9 is too old). On Debian 12 (Python 3.11) pip installs Django 5.2 LTS, which is supported until April 2028.

Create the project

django-admin startproject mysite .
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver 0.0.0.0:8000

Add your server IP or domain to ALLOWED_HOSTS in settings.py. The development server is only for testing: for production run Django with Gunicorn behind Nginx (or mod_wsgi with Apache, see "How To Configure Django With Apache In CentOS 7?").

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $135 a month.

Was this answer helpful?

Still stuck? Open a ticket