Bottle Web Framework

0.13.4 · active · verified Thu Apr 09

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.

Warnings

Install

Imports

Quickstart

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.

from bottle import route, run, template

@route('/hello/<name>')
def index(name):
    return template('<b>Hello {{name}}</b>!', name=name)

# For development, specify host explicitly due to 0.13 change
# For production, use a WSGI server like Gunicorn or uWSGI
if __name__ == '__main__':
    run(host='127.0.0.1', port=8080)

view raw JSON →