Bottle: Python Web Framework

Bottle is a fast, simple and lightweightWSGI micro web-framework forPython. It is distributed as a single file module and has no dependencies other than thePython Standard Library.

  • Routing: Requests to function-call mapping with support for clean and dynamic URLs.

  • Templates: Fast and pythonicbuilt-in template engine and support formako,jinja2 andcheetah templates.

  • Utilities: Convenient access to form data, file uploads, cookies, headers and other HTTP features.

  • Server: Built-in HTTP development server and support for a wide range ofWSGI capable HTTP server (e.g.gunicorn,paste orcheroot).

Example: “Hello World” in a bottle

frombottleimportroute,run,template@route('/hello/<name>')defindex(name):returntemplate('<b>Hello {{name}}</b>!',name=name)run(host='localhost',port=8080)

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

Download and Install

Install the latest stable release withpipinstallbottle or downloadbottle.py (unstable) into your project directory. There are no hard[1] dependencies other than the Python standard library.

Dead Snakes

Bottle up to version 0.12 supported an absurd range of Python versions, some of which reached their end-of-life well over a decade ago. Starting with Bottle 0.13 we ensure backwards compatibility withmaintained versions of Python only. Outdated Python versions may still work, but are no longer tested for compatibility.

If you are in the unfortunate position to have to rely on “dead snakes” for production, just stick with Bottle 0.12 (LTS) or whichever release of Bottle still supports it. Everyone else should upgrade regularly to benefit from new features and improvements.

Python Support Matrix

Bottle Release

Python 2

Python 3

0.12

2.5 - 2.7

3.2 - 3.12

0.13

2.7

>=3.8[2]

0.14 (planned)

dropped

>=3.9[2]

Documentation

License

Code and documentation are available according to the MIT License:

Copyright(c)2009-2025,MarcelHellkamp.Permissionisherebygranted,freeofcharge,toanypersonobtainingacopyofthissoftwareandassociateddocumentationfiles(the"Software"),todealintheSoftwarewithoutrestriction,includingwithoutlimitationtherightstouse,copy,modify,merge,publish,distribute,sublicense,and/orsellcopiesoftheSoftware,andtopermitpersonstowhomtheSoftwareisfurnishedtodoso,subjecttothefollowingconditions:TheabovecopyrightnoticeandthispermissionnoticeshallbeincludedinallcopiesorsubstantialportionsoftheSoftware.THESOFTWAREISPROVIDED"AS IS",WITHOUTWARRANTYOFANYKIND,EXPRESSORIMPLIED,INCLUDINGBUTNOTLIMITEDTOTHEWARRANTIESOFMERCHANTABILITY,FITNESSFORAPARTICULARPURPOSEANDNONINFRINGEMENT.INNOEVENTSHALLTHEAUTHORSORCOPYRIGHTHOLDERSBELIABLEFORANYCLAIM,DAMAGESOROTHERLIABILITY,WHETHERINANACTIONOFCONTRACT,TORTOROTHERWISE,ARISINGFROM,OUTOFORINCONNECTIONWITHTHESOFTWAREORTHEUSEOROTHERDEALINGSINTHESOFTWARE.

The Bottle logo however isNOT covered by that license. It is allowed touse the logo as a link to the bottle homepage or in direct context withthe unmodified library. In all other cases please ask first.

Footnotes

[1]

Usage of the template or server adapter classes requires the corresponding template or server modules.

[2](1,2)

Bottle often still works with recently discontinued Python 3.x versions. We will not intentionally break compatibility, but also no longer test against those versions. Use at your own risk.