whitenoise
Radically simplified static file serving for WSGI applications
What it is and what it does
WhiteNoise is a WSGI middleware that allows Python web applications to serve their own static files without relying on external services like nginx or Amazon S3. It wraps any WSGI-compatible application and intercepts requests for static assets, handling them efficiently within the application itself. This makes deployments simpler and more self-contained, particularly valuable on Platform-as-a-Service providers where external services may be unavailable or costly.
The package automates several static-file best practices: it compresses responses using gzip and Brotli formats with proper Accept-Encoding and Vary header handling, sets far-future cache headers on immutable content, and includes special auto-configuration for Django applications. It is designed to work alongside CDNs for high-traffic sites, so adopting it does not sacrifice performance for simplicity.
Use it for:
- Deploy a Django app to Heroku or OpenShift without configuring external static file storage.
- Serve CSS, JavaScript, and images from a containerized Python application without nginx.
- Simplify local development by eliminating separate static file server setup.
- Reduce deployment complexity for small-to-medium traffic sites by bundling static serving.
- Enable gzip and Brotli compression of static assets with automatic header management.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
WhiteNoise serves static files directly from a Python WSGI application without requiring a separate web server or CDN, handling compression, caching headers, and best practices automatically.
Yes. WhiteNoise is production-stable, actively maintained, has zero security vulnerabilities, requires no external dependencies, and solves a common deployment pain point. Install it if you are deploying a WSGI or Django application to a managed platform or containerized environment where you want static files bundled with the app.
Install
whitenoise on PyPI
pip
pip install whitenoiseuv
uv add whitenoisepoetry
poetry add whitenoiseInstalling whitenoise
Before you install
Low install friction with no runtime dependencies. Actively maintained as of 2026-02-27 with recent commits, and marked Production/Stable.
License in practice
MIT license permits commercial and private use with minimal restrictions—straightforward permissive terms suitable for most projects.
Quickstart
pip install whitenoise==6.12.0
from whitenoise import WhiteNoise
app = WhiteNoise(application, root='staticfiles')
Requires Python 3.10 or later; application must be WSGI-compatible.
Verify before relying
- Performance comparison with dedicated static file servers under high traffic loads.
- Specific CDN integration patterns and recommended configurations.
- Exact performance characteristics when serving compressed content formats.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 168 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 16,674,728/month — #1,143 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: whitenoise-6.12.0-py3-none-any.whl
Keywords: Django
Tags
More Middleware packages
Werkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
bottleBottle is a lightweight WSGI microframework for…
permissive · top 5,000 on PyPI
WebObWebOb provides request and response objects…
permissive · top 5,000 on PyPI
repoze-lruA lightweight LRU (least recently used) cache…
permissive · top 5,000 on PyPI
PasteDeployPasteDeploy loads and configures WSGI…
permissive · top 5,000 on PyPI
PastePaste provides WSGI middleware components for…
permissive · top 5,000 on PyPI
django-herokuConfigures Django applications for Heroku…
permissive · top 15,000 on PyPI
servestaticServeStatic serves static files efficiently…
permissive · top 15,000 on PyPI
dj-staticWraps a WSGI application to serve static files…
permissive · top 15,000 on PyPI
static3Serves static and templated content over WSGI,…
copyleft · top 15,000 on PyPI
Flask-CompressFlask-Compress automatically compresses Flask…
permissive · top 5,000 on PyPI
starlette-compressMiddleware for Starlette and FastAPI that…
permissive · top 5,000 on PyPI
starlette-cramjamMiddleware for Starlette that compresses HTTP…
permissive · top 15,000 on PyPI
zappaZappa packages and deploys Python WSGI and ASGI…
permissive · top 15,000 on PyPI