Skip to content

Use more efficient reloader in backend container #83

Open
@simonbru

Description

@simonbru

Django's dev server uses almost no CPU time when idle with the watchman reloader. However this requires the watchman binary and pywatchman library.

The watchman binary is packaged in debian bullseye, but not the current stable release (buster).
I tried copying the binary from a 3rd party image in the Dockerfile. It is ugly but it works:

COPY --from=workbenchdata/watchman-bin:latest-buster-slim /usr/bin/watchman /usr/local/bin/
RUN install -m777 -d /usr/var/run/watchman/

An alternative solution could be to use runserver_plus from django extensions with the watchdog reloader. It is less efficient (~2% of idle CPU usage on my machine), but easier to setup (we just need to add watchdog to dev requirements).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions