Bottle: Python Web Framework

Bottle is a fast, simple and lightweight WSGI micro web-framework for Python. It is distributed as a single file module and has no dependencies other than the standard Python library.

Routing: Role call assignment request with support for clean and dynamic URLs.

Templates: Fast and pythonic built-in template engine and support for mako, jinja2 and cheetah templates.

Utilities: Convenient access to form data, uploaded files, cookies, headers, and other HTTP-related metadata.

Server: Built-in HTTP development server and support for paste, fapws3, bjoern, gae, cherrypy or any other WSGI capable HTTP server.

Example: “Hello World” in a bottle

From the bottle import path, run, template

@route (‘/ hello / <name>’) Def index (name):

Return template (‘ Hello Template: Name </ b>!’, Name = name)

Run (host = ‘localhost’, port = 8080)

Run this script or paste it into a Python console, then point your browser to http: // localhost: 8080 / hello / world. That’s.

Install the latest stable version with the pip install bottle or download (non-stable version) in your project directory. There are no hard dependencies other than the standard Python library. Bottle supports Python 2.7 and Python 3.

Depreciated since version 0.13: Support for Python 2.5 and 2.6 was removed with this version.


Leave a Comment