--- id: servestatic version: "4.3.1" license: MIT license_treatment: permissive maintenance: active --- # servestatic — Production-grade static file server for Python WSGI & ASGI. License: permissive · Maintenance: active · Downloads: 179.4K/mo ## What it is and what it does ServeStatic is a static file server middleware for Python web applications that handles compression, cache headers, and CDN integration automatically. It works as a drop-in middleware for ASGI and WSGI apps, or as a standalone server, and is designed to simplify deployments on platforms like Heroku and OpenShift where external services are unavailable or undesirable. The package pre-computes file metadata and headers at initialization, then serves requests with minimal overhead. It automatically handles Accept-Encoding negotiation, sets far-future cache headers for immutable files, and integrates with CDNs to ensure the vast majority of traffic bypasses your application entirely. A CLI provides utilities for multi-format compression, filename hashing, and manifest generation. Django users get extra auto-configuration features. Use it for: - Deploy a Django or FastAPI app to Heroku or OpenShift without managing a separate Nginx instance. - Serve static assets behind a CDN with automatic cache-busting via filename hashing. - Eliminate S3 push-based deployment complexity by serving static files directly from your app with CDN caching. - Automatically compress and serve gzip or brotli variants of CSS and JavaScript based on client Accept-Encoding. - Run a self-contained production app that handles both dynamic content and static files without external dependencies. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. ServeStatic serves static files efficiently from Python ASGI/WSGI applications with automatic compression, cache headers, and CDN integration, eliminating the need for separate web servers or external storage services. Yes. ServeStatic is production-stable, actively maintained, has no known vulnerabilities, and solves a real deployment problem—especially on PaaS platforms. The single lightweight dependency and low install friction make it a practical choice. Use it if you need static file serving without external infrastructure; skip it if you already have Nginx or S3 in your stack. ## Install pip install servestatic uv add servestatic poetry add servestatic ## Installing servestatic Before you install: Low friction: single pure-Python dependency (asgiref), wheel-only distribution, and active maintenance with a recent release 68 days ago. Supports Python 3.10 through 3.14. License in practice: MIT license (permissive) allows free use, modification, and distribution in commercial and private projects with minimal restrictions. Quickstart: pip install servestatic from servestatic import ServeStaticMiddleware app = ServeStaticMiddleware(app, root='staticfiles') Requires Python 3.10 or later; asgiref must be installed as a runtime dependency. Verify before relying: - Whether the package's performance claims (dictionary lookup, sendfile syscall) are verified under real-world load. - Specific CDN providers tested or recommended for optimal caching behavior. - Whether Django auto-configuration features are documented with examples. - Compression format support (gzip, brotli, zstd) and their default enablement. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 179.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags static file serving python, asgi wsgi static files, cdn-friendly file serving, python static middleware, heroku static files, compressed static assets, cache headers automation, static-files, middleware, paas-deployment [View on SkillFed](https://skillfed.io/packages/servestatic) · [View on PyPI](https://pypi.org/project/servestatic/)