Skip to main content

django_npm_dev

When you're using a tool like vite, webpack, or even just TailwindCSS and PostCSS to package frontend assets that require a build step with your Django site, you frequently need to start a separate development server using npm run dev whenever you're using the Django development server to work locally.

django_npm_dev provides a Django management command that starts that npm dev server in a separate thread and then starts Django's development server. Stopping Django's development server in any of the usual ways will also stop the npm dev script.

Frequently, I'm happy to just use a bash script like this one. When I need to hand a project to someone who works on Windows, though, that becomes a challenge. I also find that IDEs (and especially their built-in debuggers) work more smoothly with Django management commands than they do with shell scripts, in my experience.

Installation and Usage

Add django-npm-dev to your project using pip or your favorite package management tool.

pip install django-npm-dev
uv add django-npm-dev

Then add django_npm_dev to your INSTALLED_APPS in your site's settings.py

INSTALLED_APPS = [
    ...,
    'django_npm_dev',
    ...,
]

Now, instead of running npm run dev followed by python manage.py runserver to start your local development server, just run python manage.py dev runserver.

Tips

If you're using Vite, and you make changes to django templates in addition to assets built by Vite, you should use install django-browser-reload so that django template changes trigger a reload as well as changes to Vite-managed assets.


If NPM isn't on your path, specify the path to your NPM command in settings.py:

NPM_BIN_PATH=/opt/local/bin/npm

Credits

Reading Cory Zue's article about using Vite with Django and his comment when I suggested that this might fit with the starter he published as a companion made me think it belonged in its own package.

The NPM wrapper is an adapted version of the one from django-tailwind.

License

All original code in this repository is copyright 2025 Geoff Beier geoff@tuxpup.com. It's offered under the same MIT LICENSE as the NPM wrapper that I adapted from django-tailwind. Any other code distributed with this repository remains under copyright by its authors, and is used under their respective licenses.

Metadata

Release files for django-npm-dev 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-npm-dev 0.3.0
File Size Uploaded Provenance Actions
django_npm_dev-0.3.0.tar.gz 4.3 kB Without provenance Details for django_npm_dev-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-npm-dev 0.3.0
File Interpreter ABI Platform Actions
django_npm_dev-0.3.0-py3-none-any.whl Python 3 none any Details for django_npm_dev-0.3.0-py3-none-any.whl

Total release size: 10.9 kB

Release files / django_npm_dev-0.3.0.tar.gz

Download URL django_npm_dev-0.3.0.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
87d84e84d6d4493e23452ab6dd6bb11dcf70092e659c1bbeb6cb7d256e570eb2
BLAKE2b-256 checksum
How to use checksums
420722b70cf193ab3b6d455a63e80084d8d765525f5f9ccfac371eb54a2e91fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.0

Release files / django_npm_dev-0.3.0-py3-none-any.whl

Download URL django_npm_dev-0.3.0-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f04b6039c6e7da9812ffa81a71c42594652b245ea0d2b03dcc9793f5b7ca4e7
BLAKE2b-256 checksum
How to use checksums
fbfb2de9bea1e9125fbbc2f872a439475fa244f8310b5277a332ee49bafef467
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.0

Security for django-npm-dev 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page