Skip to main content

Werkzeug integration for Bottle.

Project description

This plugin adds support for :class:`werkzeug.Response`, all kinds of
:exc:`werkzeug.exceptions` and provides a thread-local instance of
:class:`werkzeug.Request`. It basically turns Bottle into Flask.

The plugin instance doubles as a werkzeug module object, so you don't need to
import werkzeug in your application.

For werkzeug library documentation, see: http://werkzeug.pocoo.org/

Example::

import bottle

app = bottle.Bottle()
werkzeug = bottle.ext.werkzeug.Plugin()
app.install(werkzeug)

req = werkzueg.request # For the lazy.

@app.route('/hello/:name')
def say_hello(name):
greet = {'en':'Hello', 'de':'Hallo', 'fr':'Bonjour'}
language = req.accept_languages.best_match(greet.keys())
if language:
return werkzeug.Response('%s %s!' % (greet[language], name))
else:
raise werkzeug.exceptions.NotAcceptable()

Project details


Download files

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

Files for bottle-werkzeug, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size bottle-werkzeug-0.1.tar.gz (3.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page