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).
Django's dev server uses almost no CPU time when idle with the watchman reloader. However this requires the
watchman
binary andpywatchman
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:An alternative solution could be to use
runserver_plus
from django extensions with thewatchdog
reloader. It is less efficient (~2% of idle CPU usage on my machine), but easier to setup (we just need to addwatchdog
to dev requirements).