Each Bottle object represents a single, distinct web application and consists of routes, callbacks, plugins, resources and configuration. Instances are callable WSGI applications. :param catchall: If true (default), handle all exceptions. Turn off to let debugging middleware handle exceptions.
Method | __call__ |
Each instance of :class:'Bottle' is a WSGI application. |
Method | __init__ |
Undocumented |
Method | add |
Attach a callback to a hook. Three hooks are currently implemented: |
Method | add |
Add a route object, but do not change the :data:`Route.app` attribute. |
Method | close |
Close the application and all installed plugins. |
Method | default |
Undocumented |
Method | delete |
Equals :meth:`route` with a ``DELETE`` method parameter. |
Method | error |
Decorator: Register an output handler for a HTTP error code |
Method | get |
Equals :meth:`route`. |
Method | get |
Return a string that matches a named route |
Method | hook |
Return a decorator that attaches a callback to a hook. See :meth:`add_hook` for details. |
Method | install |
Add a plugin to the list of plugins and prepare it for being applied to all routes of this application. A plugin may be a simple decorator or an object that implements the :class:`Plugin` API. |
Method | match |
Search for a matching route and return a (:class:`Route` , urlargs) tuple. The second value is a dictionary with parameters extracted from the URL. Raise :exc:`HTTPError` (404/405) on a non-match. |
Method | merge |
Merge the routes of another :class:`Bottle` application or a list of :class:`Route` objects into this application. The routes keep their 'owner', meaning that the :data:`Route.app` attribute is not changed... |
Method | mount |
Mount an application (:class:`Bottle` or plain WSGI) to a specific URL prefix. Example:: |
Method | post |
Equals :meth:`route` with a ``POST`` method parameter. |
Method | put |
Equals :meth:`route` with a ``PUT`` method parameter. |
Method | remove |
Remove a callback from a hook. |
Method | reset |
Reset all routes (force plugins to be re-applied) and clear all caches. If an ID or route object is given, only that specific route is affected. |
Method | route |
A decorator to bind a function to a request URL. Example:: |
Method | run |
Calls :func:`run` with the same parameters. |
Method | trigger |
Trigger a hook and return a list of results. |
Method | uninstall |
Uninstall plugins. Pass an instance to remove a specific plugin, a type object to remove all plugins that match that type, a string to remove all plugins with a matching ``name`` attribute or ``True`` to remove all plugins... |
Method | wsgi |
The bottle WSGI-interface. |
Class Variable | catchall |
Undocumented |
Instance Variable | config |
Undocumented |
Instance Variable | error |
Undocumented |
Instance Variable | plugins |
Undocumented |
Instance Variable | resources |
Undocumented |
Instance Variable | router |
Undocumented |
Instance Variable | routes |
Undocumented |
Instance Variable | stopped |
Undocumented |
Method | _cast |
Try to convert the parameter into something WSGI compatible and set correct HTTP headers when possible. Support: False, str, unicode, dict, HTTPResponse, HTTPError, file-like, iterable of strings and iterable of unicodes... |
Method | _handle |
Undocumented |
Class Variable | __hook |
Undocumented |
Class Variable | __hook |
Undocumented |
Property | _hooks |
Undocumented |
Attach a callback to a hook. Three hooks are currently implemented: before_request Executed once before each request. The request context is available, but no routing has happened yet. after_request Executed once after each request regardless of its outcome. app_reset Called whenever :meth:`Bottle.reset` is called.
Add a plugin to the list of plugins and prepare it for being applied to all routes of this application. A plugin may be a simple decorator or an object that implements the :class:`Plugin` API.
Search for a matching route and return a (:class:`Route` , urlargs) tuple. The second value is a dictionary with parameters extracted from the URL. Raise :exc:`HTTPError` (404/405) on a non-match.
Merge the routes of another :class:`Bottle` application or a list of :class:`Route` objects into this application. The routes keep their 'owner', meaning that the :data:`Route.app` attribute is not changed.
Mount an application (:class:`Bottle` or plain WSGI) to a specific URL prefix. Example:: root_app.mount('/admin/', admin_app) :param prefix: path prefix or `mount-point`. If it ends in a slash, that slash is mandatory. :param app: an instance of :class:`Bottle` or a WSGI application. All other parameters are passed to the underlying :meth:`route` call.
Reset all routes (force plugins to be re-applied) and clear all caches. If an ID or route object is given, only that specific route is affected.
A decorator to bind a function to a request URL. Example:: @app.route('/hello/:name') def hello(name): return 'Hello %s' % name The ``:name`` part is a wildcard. See :class:`Router` for syntax details. :param path: Request path or a list of paths to listen to. If no path is specified, it is automatically generated from the signature of the function. :param method: HTTP method (`GET`, `POST`, `PUT`, ...) or a list of methods to listen to. (default: `GET`) :param callback: An optional shortcut to avoid the decorator syntax. ``route(..., callback=func)`` equals ``route(...)(func)`` :param name: The name for this route. (default: None) :param apply: A decorator or plugin or a list of plugins. These are applied to the route callback in addition to installed plugins. :param skip: A list of plugins, plugin classes or names. Matching plugins are not installed to this route. ``True`` skips all. Any additional keyword arguments are stored as route-specific configuration and passed to plugins (see :meth:`Plugin.apply`).
Uninstall plugins. Pass an instance to remove a specific plugin, a type object to remove all plugins that match that type, a string to remove all plugins with a matching ``name`` attribute or ``True`` to remove all plugins. Return the list of removed plugins.