Skip to content

Setting Up the Project

The course's starter repo contains our project's tooling. The Django project comes in chapter 2.

Clone the Starter Repo

shell
git clone https://github.com/nnja/django-fundamentals-exercises.git
cd django-fundamentals-exercises

For each exercise, you'll grab a local copy of the branch with all the files you need.

Add the solutions repo as a second remote so you can diff against it when you get stuck:

shell
git remote add solutions https://github.com/nnja/django-fundamentals-solutions.git
git fetch solutions

Install the Dependencies

shell
uv sync

uv creates a virtual environment in .venv/ and installs the packages listed in pyproject.toml.

What was installed?

pyproject.toml lists our development tools:

  • pytest and pytest-django: To run the tests that come with each exercise. pytest-django lets pytest run Django's tests: it loads the settings and creates a test database.
  • Ruff: The linter and formatter.
  • djLint: The linter and formatter for Django templates.

What's in the Starter

  • pyproject.toml: The project's dependencies.
  • ruff.toml: Ruff's configuration, with its Django rules turned on.
  • djlint.toml: djLint's configuration.
  • .vscode/: Editor settings and a list of recommended extensions.
  • AGENTS.md: Instructions for AI coding agents.

Open the Project in VS Code

shell
code . # open in vs code, trust the authors

VS Code will open a pop-up and ask to install this project's recommended extensions.

  • Python: Runs and debugs Python, provides autocompletion.
  • Ruff: Shows lint errors as you type, and formats a file each time you save it (configurable).
  • Python Environments: Manages virtual environments, should use the one that uv created by default.
  • Django: Syntax highlighting for Django templates.
  • djLint: Shows lint errors in templates, and formats a template on save.
If the editor underlines Django's imports

VS Code isn't using the project's environment. Run Python: Select Interpreter from the Command Palette and choose the one in .venv. Open a new terminal afterwards, so it uses that environment too.

PyCharm Professional

PyCharm Professional is a popular IDE for Django, with better support for Django code and templates. It's a paid subscription.