Skip to content

RescueScout Codebase Walkthrough

The finished version of RescueScout is at github.com/nnja/django-fundamentals.

It's the application we built, with a few additions:

  • Django Debug Toolbar, while DEBUG is on
  • The admin's branding, and a search box for the animal on an application
  • An About page
  • Links that sort the list page by newest arrivals or youngest first

Its templates and stylesheet are fuller versions of ours: the same template tags and context values, inside the site's full layout.

Running the Demo

The finished application's Postgres container uses port 5432, as ours does, and its server uses port 8000. Stop ours first: the development server with Ctrl+C if it's running, then the database, from our project's folder:

shell
docker compose stop

Then, in the clone of the finished application:

shell
docker compose up -d --wait
uv run manage.py migrate
uv run manage.py seed --reset --accounts
uv run manage.py runserver

Open:

Django Debug Toolbar

Django Debug Toolbar is a third-party package that adds a panel to each page showing how Django built it. It shows the SQL queries and how long each took. It also shows the rendered templates and their context, the settings, and the request. It's a common way to find a page that runs more queries than it should.

The finished application loads it only while DEBUG is on, at the end of config/settings.py:

config/settings.py
if DEBUG:
    INSTALLED_APPS += ["debug_toolbar"]
    MIDDLEWARE += ["debug_toolbar.middleware.DebugToolbarMiddleware"]
    # The toolbar shows itself only to these client addresses.
    INTERNAL_IPS = ["127.0.0.1"]

Its URL patterns are added the same way, near the end of config/urls.py.

Open the list page, and click SQL in the toolbar. The page runs two queries: a COUNT(*) for the paginator, and one for the page's animals.

The Test Suite

The finished application's tests are in tests/: a small suite covering features from the models to the API. They run the same way, with uv run pytest, on an in-memory SQLite database from config/test_settings.py.