How to Create a Django Project with UV Package Manager (Step-by-Step Guide)
Suresh Thapa
Getting Started with Python’s UV Package Manager (with Django Example)
Python developers have long relied on package managers like pip and pipenv, but a new tool called uv is gaining traction for its speed, simplicity, and modern developer experience. Built by Astral, uv is designed to be a drop-in replacement for pip/pip-tools/poetry while being significantly faster.
In this guide, we’ll explore the basics of uv and see how to create and run a Django project using it.
Why UV?
- Blazing fast: uv is written in Rust and optimized for speed.
- Simple workflows: It unifies dependency management, environments, and project scaffolding.
- Modern replacement: Works as an alternative to
pip,pip-tools, andpoetry. - Cross-platform: Works on Linux, macOS, and Windows.
Install UV via PIP.
pip install uvor go to https://docs.astral.sh/uv/getting-started/installation/ for more details.
Step 1: Initialize a New Project
uv init
This creates a new project directory with configuration files (pyproject.toml) that uv uses to manage dependencies.
Step 2: Add Django as a Dependency
uv add djangouv will update the pyproject.toml and lock file, and install Django into a virtual environment automatically.
Step 3: Start a New Django Project
uv run django-admin startproject django_project .This creates a new Django project in the current directory.
Step 4: Run the Development Server
uv run manage.py runserverOpen http://127.0.0.1:8000/ in your browser and you’ll see the default Django welcome page.
Step 5: Create a Django App
uv run manage.py startapp app1This generates a new app structure (app1/) where you can define models, views, and templates.
Step 6: Apply Migrations
Whenever you add or modify models, you need to create and apply migrations.
Create new migration files:
uv run manage.py makemigrations
Apply migrations to the database:
uv run manage.py migrateThis sets up Django’s default tables (auth, admin, sessions, etc.) in your database and applies your app’s model changes.
Why Use UV for Django?
- No need to activate/deactivate venvs – uv handles environments automatically.
- Cleaner dependency management – no more juggling
requirements.txtmanually. - Modern tooling – uv is built for performance and scales well for bigger projects.
Final Workflow Recap
Here’s the full set of commands to get started with Django using uv:
uv init
uv add django
uv run django-admin startproject django_project .
uv run manage.py runserver
uv run manage.py startapp app1
uv run manage.py makemigrations
uv run manage.py migrateWith just these commands, you have a fully working Django project managed by uv .