forked from colour-science/flask-compress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparams.json
6 lines (6 loc) · 3.64 KB
/
params.json
1
2
3
4
5
6
{
"name": "Flask-Compress",
"tagline": "Compress responses in your Flask app with gzip.",
"body": "# Flask-Compress\r\n\r\n[![Version](https://img.shields.io/pypi/v/flask-compress.svg)](https://pypi.python.org/pypi/Flask-Compress)\r\n[![Build Status](https://travis-ci.org/libwilliam/flask-compress.png)](https://travis-ci.org/libwilliam/flask-compress)\r\n[![Coverage](https://coveralls.io/repos/libwilliam/flask-compress/badge.svg)](https://coveralls.io/github/libwilliam/flask-compress)\r\n[![License](https://img.shields.io/pypi/l/flask-compress.svg)](https://github.com/libwilliam/flask-compress/blob/master/LICENSE.txt)\r\n\r\nFlask-Compress allows you to easily compress your [Flask](http://flask.pocoo.org/) application's responses with gzip.\r\n\r\nThe preferred solution is to have a server (like [Nginx](http://wiki.nginx.org/Main)) automatically compress the static files for you. If you don't have that option Flask-Compress will solve the problem for you.\r\n\r\n\r\n## How it works\r\n\r\nFlask-Compress both adds the various headers required for a compressed response and gzips the response data. This makes serving gzip compressed static files extremely easy.\r\n\r\nInternally, every time a request is made the extension will check if it matches one of the compressible MIME types and will automatically attach the appropriate headers.\r\n\r\n\r\n## Installation\r\n\r\nIf you use pip then installation is simply:\r\n\r\n```shell\r\n$ pip install flask-compress\r\n```\r\n\r\nor, if you want the latest github version:\r\n\r\n```shell\r\n$ pip install git+git://github.com/libwilliam/flask-compress.git\r\n```\r\n\r\nYou can also install Flask-Compress via Easy Install:\r\n\r\n```shell\r\n$ easy_install flask-compress\r\n```\r\n\r\n\r\n## Using Flask-Compress\r\n\r\nFlask-Compress is incredibly simple to use. In order to start gzip'ing your Flask application's assets, the first thing to do is let Flask-Compress know about your [`flask.Flask`](http://flask.pocoo.org/docs/latest/api/#flask.Flask) application object.\r\n\r\n```python\r\nfrom flask import Flask\r\nfrom flask_compress import Compress\r\n\r\napp = Flask(__name__)\r\nCompress(app)\r\n```\r\n\r\nIn many cases, however, one cannot expect a Flask instance to be ready at import time, and a common pattern is to return a Flask instance from within a function only after other configuration details have been taken care of. In these cases, Flask-Compress provides a simple function, `flask_compress.Compress.init_app`, which takes your application as an argument.\r\n\r\n```python\r\nfrom flask import Flask\r\nfrom flask_compress import Compress\r\n\r\ncompress = Compress()\r\n\r\ndef start_app():\r\n\tapp = Flask(__name__)\r\n compress.init_app(app)\r\n return app\r\n```\r\n\r\nIn terms of automatically compressing your assets using gzip, passing your [`flask.Flask`](http://flask.pocoo.org/docs/latest/api/#flask.Flask) object to the `flask_compress.Compress` object is all that needs to be done.\r\n\r\n\r\n## Options\r\n\r\nWithin your Flask application's settings you can provide the following settings to control the behavior of Flask-Compress. None of the settings are required.\r\n\r\n| Option | Description | Default |\r\n| ------ | ----------- | ------- |\r\n| `COMPRESS_MIMETYPES` | Set the list of mimetypes to compress here. | `[`<br>`'text/html',`<br>`'text/css',`<br>`'text/xml',`<br>`'application/json',`<br>`'application/javascript'`<br>`]` |\r\n| `COMPRESS_LEVEL` | Specifies the gzip compression level. | `6` |\r\n| `COMPRESS_MIN_SIZE` | Specifies the minimum file size threshold for compressing files. | `500` |\r\n",
"note": "Don't delete this file! It's used internally to help with page regeneration."
}