{"id":1405,"library":"bottle","title":"Bottle Web Framework","description":"Bottle is a fast, lightweight, and simple WSGI micro-framework for small web-applications. It provides routing, templating, and basic utilities in a single file, making it ideal for prototyping and small services. The current stable version is 0.13.4, with releases occurring infrequently, often focusing on Python version compatibility and minor fixes rather than new features.","status":"active","version":"0.13.4","language":"en","source_language":"en","source_url":"https://github.com/bottlepy/bottle","tags":["web-framework","microframework","wsgi"],"install":[{"cmd":"pip install bottle","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"Decorator for defining HTTP routes.","symbol":"route","correct":"from bottle import route"},{"note":"Function to start the development server.","symbol":"run","correct":"from bottle import run"},{"note":"Thread-local proxy to the current request object.","symbol":"request","correct":"from bottle import request"},{"note":"Thread-local proxy to the current response object.","symbol":"response","correct":"from bottle import response"},{"note":"Function to render templates (e.g., SimpleTemplate, Mako, Jinja2).","symbol":"template","correct":"from bottle import template"}],"quickstart":{"code":"from bottle import route, run, template\n\n@route('/hello/<name>')\ndef index(name):\n    return template('<b>Hello {{name}}</b>!', name=name)\n\n# For development, specify host explicitly due to 0.13 change\n# For production, use a WSGI server like Gunicorn or uWSGI\nif __name__ == '__main__':\n    run(host='127.0.0.1', port=8080)","lang":"python","description":"This quickstart defines a simple route that takes a name parameter and renders a basic HTML template using Bottle's built-in `SimpleTemplate` engine. It then starts a development server on `127.0.0.1:8080`. Note the explicit host for `run()` due to changes in Bottle 0.13."},"warnings":[{"fix":"Ensure your project's Python interpreter is version 3.7 or newer before upgrading to Bottle 0.13.x.","message":"Bottle 0.13 dropped support for Python 2.x and older Python 3.x versions (3.4, 3.5, 3.6). Projects upgrading to 0.13 or newer must use Python 3.7 or higher.","severity":"breaking","affected_versions":"0.13.0+"},{"fix":"If you need your development server to be accessible from other machines, explicitly specify `host='0.0.0.0'` in your `run()` call (e.g., `run(host='0.0.0.0', port=8080)`).","message":"The default host for `bottle.run()` changed from `0.0.0.0` (all interfaces) to `127.0.0.1` (localhost only) in version 0.13 for security reasons. This affects how your development server is accessible.","severity":"breaking","affected_versions":"0.13.0+"},{"fix":"Always access `request` and `response` within route handlers or functions called from within a handler where a request context is active. Do not try to store or access them globally outside of a request.","message":"Bottle's `request` and `response` objects are thread-local proxies. Attempting to access them outside of an active request context (e.g., at module level) will result in a `RuntimeError`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For production environments, deploy your Bottle application with a robust WSGI server such as Gunicorn, uWSGI, or CherryPy.","message":"The `bottle.run()` function is intended solely for development and testing. It uses a simple, single-threaded server and is not suitable for production deployments due to performance, reliability, and security concerns.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}