Even though simple django templates can take you very far, sometimes it's nice to use packages from the npm ecosystem. And if you're using tailwind, unless you're pulling a huge development bundle, you already need a build step. vite is a great improvement to all of this, but it still leaves you needing to both run the vite development server and the django development server in order to develop locally.

Needing to do that is something of a papercut. I’ve got shell scripts that do it nicely, but they introduce papercuts of their own. Whether that’s needing to remember to stop both processes separately, not playing nicely with the debug button in IDEs, or some other minor annoyance. It finally got old, so peeked at how django-tailwind was starting the dev watcher and bundler, and made it into a standalone package that plays quite nicely with vite.

  1. Use your package manager of choice to install django-npm-dev. I like uv lately, and uv add django-npm-dev does the job.
  2. Add django_npm_dev to your site’s INSTALLED_APPS
  3. Start your development servers by runing python manage.py dev runserver now, instead of just using runserver. It’ll accept and pass through all the parameters that the standard runserver command takes. When you stop your dev server with a keyboard interrupt, the npm dev script will stop also. It works easily with pycharm’s run configurations.

The regular way works just fine, but it’s nice to eliminate a papercut.