Skip to main content

Getting started with Django 5.2 LTS using uv

Updated 4 min readMarkdown
Part of seriesAdvanced Web Development (CM3035)
Getting started with Django 5.2 LTS using uv
Django 5.2 LTS · Python 3.14 · uv 0.13 · tested October 2026

Tested with: uv 0.13.1, Python 3.14.8 and Django 5.2.18 LTS, October 2026. Django 5.2 is the current long-term-support release, with security fixes until April 2028.

Looking for my 2021 version with Django 3.2 and pipenv, which matches the CM3035 course videos? It's here: Getting started with Django 3.2 (2021, pipenv).

Back in 2021 I set up Django with pipenv. These days I use uv, a fast Python package and project manager. One tool now does what used to take three: it installs Python itself, creates an isolated environment for your project, and records the exact version of every package so anyone can rebuild the same set-up.

Step 1: Install uv

On macOS or Linux:

curl -LsSf https://astral.sh/uv/install.sh | sh

On Windows (PowerShell):

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

If you use Homebrew, brew install uv also works. Open a new terminal, then check:

uv --version

Step 2: Create a project

uv init --app --no-package mysite --python 3.14
cd mysite

This creates a mysite folder with:

  • pyproject.toml: your project's settings and its list of dependencies (like package.json in JavaScript, or the Pipfile in my old post);

  • .python-version: the Python version for this project (3.14);

  • README.md, a starter main.py (you can delete it) and a git repository.

If Python 3.14 isn't on your computer yet, uv downloads it for you. You don't need to install Python separately.

Why --no-package? Since version 0.12, uv init sets projects up to be built as installable Python packages, in a src/ folder. A Django site isn't a package, so --no-package keeps the simple layout Django expects.

Step 3: Add Django

uv add "django>=5.2,<5.3"

The version range keeps you on the 5.2 LTS series, so you get its security fixes but never jump to a new major version by accident. uv creates a .venv environment, installs Django into it, adds Django to pyproject.toml, and writes uv.lock, which records the exact version of every package (Django 5.2.18, asgiref, sqlparse).

Step 4: Start the Django project

uv run django-admin startproject config .

The . at the end creates the project in the current folder instead of a new subfolder. You now have manage.py and a config folder holding settings.py, urls.py, asgi.py and wsgi.py.

uv run runs a command inside the project's environment. You don't need to activate the environment first, and it works the same on macOS, Linux and Windows.

Step 5: Run it

uv run python manage.py migrate
uv run python manage.py runserver

Open http://127.0.0.1:8000/ and you should see Django's welcome page with the rocket. Press Ctrl+C to stop the server.

Sharing your project (or rebuilding it on another computer)

Commit pyproject.toml, uv.lock and .python-version to git, but not .venv, which uv's .gitignore already leaves out. On another computer, after cloning:

uv sync

uv sync installs the right Python and the exact package versions from uv.lock. This is what pipenv's Pipfile.lock did, only much faster.

Other everyday commands:

Task Command
Add a package uv add djangorestframework
Remove a package uv remove djangorestframework
See what's installed uv tree
Upgrade within your version range uv lock --upgrade-package django then uv sync

Following the course instead?

The CM3035 course guide uses Python's built-in venv and pip. That works too. The equivalent of the steps above is:

python3 -m venv .venv
source .venv/bin/activate        # Windows: .venv\Scripts\activate
python -m pip install "django>=5.2,<5.3"
django-admin startproject config .
python manage.py runserver

uv simply does the same with fewer steps and a lockfile.

Resources

12 views

About the author

  • Head of eLearning at the University of Cambridge Language Centre, full-stack developer and AI engineer, and online tutor on the BSc Computer Science from Goldsmiths, University of London, on Coursera. I started out in neuroscience research before moving into web development, and have spent over twenty years building digital learning at Cambridge. This blog is my supplementary material for students on the BSc: set-up guides, explanations of the ideas that trip people up, and worked examples. New here? Click Website above for my Start here page and module guides.

No comments yet. Be the first to comment.

More from this blog