This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
# Flask-optimize

[![Build Status](](

- **Flask optimization using cache, minify html and gzip response**
- **Support limit decorator, redirect host and cross-site HTTP**

## Optimize parameters

### init_app:

**config:** Global config


"html": {"htmlmin": True, "izip": True, "cache": "GET-84600"},
"json": {"htmlmin": False, "izip": True, "cache": False},
"text": {"htmlmin": False, "izip": True, "cache": 84600},
"limit": [100, 60, 84600],
"redirect_host": [],
"exceed_msg": None

`html`, `json`, `text`: keys for data type of response, see detail below

`limit`: [number requests, in period time (seconds), abandon timeout if exceed (seconds)], require `redis`

`redirect_host`: [['', ''], ''] redirect other domains to one

`exceed_msg`: (default return {'status_code': 429}) route in exceed message case

**config_update:** update into default global config

### optimize

**dtype:** Data type of response, will get value corresponding with key in global config.

- `html` *(default)*
- `text`
- `json`

**htmlmin:** Override `htmlmin` in config by key **dtype**

None: using default value from global config
True: enable minify html
False: disable

**izip:** Override `izip` in config by key **dtype**

None: using default value from global config
True: enable zip content
False: disable

**cache:** Override `cache` in config by key **dtype**

None: using default value from global config
GET-84600: enable for GET method only, cached time is 84600 seconds
84600: enable, cached time is 84600 seconds
False: disable

## Python code usage

from flask import Flask
from flask_optimize import FlaskOptimize

flask_app = Flask(__name__)
flask_optimize = FlaskOptimize()

def index():
return 'using Flask-optimize'

def html():
return '''
Default data type is html.
This content will be minified.

def text():
return '''
Data type response is text, so this content wasn't minified

def json():
return {'text': 'anything', 'other_values': [1, 2, 3, 4]}

if __name__ == '__main__':'localhost', 8080, debug=True)

## Install

pip install flask-optimize

## Requirements: ##

* Python 2.x
* Python 3.x
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
flask_optimize-0.2.6-py2.py3-none-any.whl (5.1 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Apr 4, 2017
flask-optimize-0.2.6.tar.gz (5.6 kB) Copy SHA256 Checksum SHA256 Source Apr 4, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting