Skip to main content

Serve static files directly from a WSGI application

Project description

Build Status Latest PyPI version

WSGI middleware for easy serving of static files, with optional integration with Django. Secure and efficient enough to use in production, and designed to be CDN-friendly for high-traffic sites.

Just wrap your WSGI application in the WhiteNoise middleware, give it the path to your static files directory and any requests matching files in that directory will be served correctly. All other requests are passed on to your application.

Features

  • Simple to configure
  • Handles caching (sends cache headers and returns Not Modified responses when appropriate)
  • Serves gzipped content (handling Accept-Encoding and Vary headers correctly)
  • Provides hooks for customisation, e.g. sending custom headers for certain files
  • Can serve static files from arbitrary URLs, not just from a fixed URL prefix, so you can use it to serve files like /favicon.ico or /robots.txt
  • Django version can automatically gzip your files, create uniquely-named versions of each file and set them to be cached forever – all with one line of config

Documentation

Shouldn’t I be using a real webserver, or a CDN, or Amazon S3? See Infrequently Asked Questions

Compatibility

WhiteNoise works with any WSGI-compatible application and is tested on Python 2.7, 3.3 and 3.4

DjangoWhiteNoise is tested with Django versions 1.41.7

Endorsements

WhiteNoise is being used in Warehouse, the in-development replacement for the PyPI package repository.

Some of Django and pip’s core developers have said nice things about it:

@jezdez: “[WhiteNoise] is really awesome and should be the standard for Django + Heroku

@dstufft: “Whitenoise looks pretty excellent.

Issues

See the GitHub issue tracker.

License

MIT Licensed

Project details


Release history Release notifications

History Node

4.0b4

History Node

4.0b3

History Node

4.0b2

History Node

4.0b1

History Node

3.3.1

History Node

3.3.0

History Node

3.2.3

History Node

3.2.2

History Node

3.2.1

History Node

3.2

History Node

3.1

History Node

3.0

History Node

3.0rc1

History Node

3.0b1

History Node

2.0.6

History Node

2.0.5

History Node

2.0.4

History Node

2.0.3

History Node

2.0.2

History Node

2.0.1

History Node

2.0

History Node

1.0.6

History Node

1.0.5

History Node

1.0.4

History Node

1.0.3

History Node

1.0.2

History Node

1.0.1

This version
History Node

1.0

History Node

0.13

History Node

0.12

History Node

0.11

History Node

0.10

History Node

0.9

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
whitenoise-1.0-py2.py3-none-any.whl (12.1 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Apr 14, 2014
whitenoise-1.0.tar.gz (346.0 kB) Copy SHA256 hash SHA256 Source None Apr 14, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page