Forked from https://bitbucket.org/luke/static/
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'))
Automatically detects and sends if gzipped content is
requested and available. Example:
index.html tries to find
in the same directory.
Gzip is disbaled for Pre SP2 IE6 and IE5 browsers. Read more here: http://sebduggan.com/blog/ie6-gzip-bug-solved-using-isapirewrite/
Pushing beyond gzipping is implemented now. Read more about it here: http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
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.
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).
CHARSETS = [ ('*.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
send a specific header with all files.
CUSTOM_HEADERS = [ ('*.html', "X-UA-Compatible", "IE=Edge,chrome=1"), ] app = static.Cling('.', custom_headers=CUSTOM_HEADERS)
Here are the suggested features for future:
- Cache Busting using filename rewrites instead of query strings (http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/)
Created and maintained by Luke Arno firstname.lastname@example.org
Modified by Irfan Ahmad http://i.com.pk/
Copyright (C) 2006-2009 Luke Arno - http://lukearno.com/
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 http://lukearno.com/