Skip to content
No description, website, or topics provided.
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.

Forked from


A really simple WSGI way to serve static (or mixed) content.

See docstrings of static module for details.

Changes in this fork

Following features are added:

Custom mimetypes support for StatusApp

Used for html 404 errors.


app = static.Cling('.', not_found=static.StatusApp('404 Not Found', file='./404.html'))

Gzip support

Automatically detects and sends if gzipped content is requested and available. Example: index.html tries to find index.html.gz in the same directory.

Gzip is disbaled for Pre SP2 IE6 and IE5 browsers. Read more here:

Pushing beyond gzipping is implemented now. Read more about it here:

Expire/Cache-Control headers support

For better performance. Trying to keep syntax similar to Apache's ExpiresByType. You can specify the expires headers in seconds against each mime type.


    # html
    ('text/html', 0), # No cache

    # feed
    ('application/xml', 60*60), # 1 hour

    # favicon
    ('image/x-icon', 7*24*60*60), # 1 week

    # media
    ('image/gif', 30*24*60*60), # 1 month
    ('image/jpeg', 30*24*60*60), # 1 month
    ('image/png', 30*24*60*60), # 1 month

    # CSS and Javascript
    ('application/javascript', 365*24*60*60), # 1 year
    ('text/css', 365*24*60*60), # 1 year
app = static.Cling('.', expire_headers=EXPIRES)

Support for setting up charset

For better browser rendering performance. Again, trying to keep it similar to Apache's AddCharset. Charset can be set for filename patterns (file extensions in most of the cases).


    ('*.html', 'UTF-8'),  # Default for html files
    ('*.ja.html', 'SHIFT_JIS'),

app = static.Cling('.', charsets=CHARSETS)

Support for custom headers

Custom headers can be sent for matching file patterns. Use * to send a specific header with all files.


    ('*.html', "X-UA-Compatible", "IE=Edge,chrome=1"),

app = static.Cling('.', custom_headers=CUSTOM_HEADERS)


Here are the suggested features for future:


Created and maintained by Luke Arno

Modified by Irfan Ahmad

Copyright (C) 2006-2009 Luke Arno -

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to:

The Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Luke Arno can be found at

You can’t perform that action at this time.