Skip to main content

CORS handling as a cherrypy tool.

Project description

https://img.shields.io/pypi/v/cherrypy_cors.svg https://img.shields.io/pypi/pyversions/cherrypy_cors.svg https://img.shields.io/pypi/dm/cherrypy_cors.svg https://img.shields.io/travis/yougov/cherrypy-cors/master.svg

CORS support for CherryPy

License

License is indicated in the project metadata (typically one or more of the Trove classifiers). For more details, see this explanation.

In a nutshell

In your application, either install the tool globally.

import cherrypy_cors
cherrypy_cors.install()

Or add it to your application explicitly.

import cherrypy_cors
app = cherrypy.tree.mount(...)
app.toolboxes['cors'] = cherrypy_cors.tools

Then, enable it in your cherrypy config. For example, to enable it for all static resources.

config = {
    '/static': {
        'tools.staticdir.on': True,
        'cors.expose.on': True,
    }
}

See simple-example for a runnable example.

Project details


Download files

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

Source Distribution

cherrypy-cors-1.6.tar.gz (9.5 kB view hashes)

Uploaded source

Built Distribution

cherrypy_cors-1.6-py2.py3-none-any.whl (6.0 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page