Skip to content

Instantly share code, notes, and snippets.

@mcshakes
Last active August 8, 2025 19:29
Show Gist options
  • Save mcshakes/7188961dea7fcff86912945b748f9808 to your computer and use it in GitHub Desktop.
Save mcshakes/7188961dea7fcff86912945b748f9808 to your computer and use it in GitHub Desktop.
Usage of UV with DRF
  • Ensure UV has the python

uv python install 3.12

  • Create the project using the real django-admin from the django package

uvx -p 3.12 --from django django-admin startproject #{project_name}

  • Go into the project and add the packages

uv init to create pyproject.toml

  • install

uv add djangorestframework django-environ django-cors-headers

  • check that you are in correct virtual environment:

uv run python --version

  • add in all the stuff for settings.py, and .env and nonsense... but now you need to create the /API or actual working folder. So you do this:

uv run python manage.py startapp api or uvx django-admin startapp api

and always run django stuff with uv:

uv run python manage.py migrate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment