explaingit

bottlepy/bottle

8,764PythonAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

Bottle is a tiny Python web framework that fits in a single file with no external dependencies, define URL routes and serve web responses in a handful of lines.

Mindmap

mindmap
  root((Bottle))
    Routing
      URL decorators
      Variable route parts
    Templates
      Built-in engine
      Jinja2 and Mako
    HTTP tools
      Form and file upload
      Cookies and headers
    Deployment
      Dev server built-in
      Gunicorn WSGI
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Build a simple REST API or web service without installing a large framework.

USE CASE 2

Add a small web interface to an existing Python script or tool with minimal setup.

USE CASE 3

Learn how web routing and HTTP request handling work in Python using a minimal, readable codebase.

USE CASE 4

Prototype a quick web endpoint that reads form data or query parameters and returns a response.

Tech stack

PythonWSGI

Getting it running

Difficulty · easy Time to first run · 5min
MIT license, use freely for any purpose, including commercial, as long as you keep the copyright notice.

In plain English

Bottle is a minimal Python web framework for building web applications and APIs. It is distributed as a single Python file with no external dependencies, meaning you can drop one file into a project directory and start using it immediately without installing anything beyond Python itself. The framework handles the fundamental tasks of a web server. You define URL routes by decorating Python functions, and Bottle calls those functions when a matching request arrives. URLs can include variable parts, so a single route like "/hello/<name>" will match any name and pass it to the function as an argument. Bottle also includes a built-in template engine for generating HTML, though it works with popular third-party engines like Jinja2 and Mako if you prefer those. Other built-in tools cover reading form data, handling file uploads, working with cookies, and accessing HTTP headers. For running the application, Bottle ships a simple development server sufficient for testing, and it supports connecting to production-grade WSGI servers like Gunicorn or CherryPy's Cheroot for real deployments. A working Hello World example is a handful of lines: import a couple of names, decorate a function with a route, and call run. The framework targets situations where a larger, more opinionated framework would be more than the project needs. It does not include a built-in database layer, admin panel, or authentication system. Installation is one pip command. The code and documentation are available under the MIT license.

Copy-paste prompts

Prompt 1
Using Bottle, write a Python REST API with GET, POST, PUT, and DELETE endpoints for managing a list of items stored in a Python dictionary.
Prompt 2
How do I read JSON from a POST request body in Bottle and return a JSON response? Show a minimal working example.
Prompt 3
I want to serve an HTML page using Bottle's built-in template engine. Show me how to define a route, render a template, and pass variables into it.
Prompt 4
How do I deploy a Bottle app with Gunicorn for production? Walk me through the steps from a single-file app to a running server.
Prompt 5
Write a Bottle route that accepts a file upload, saves it to a folder on disk, and returns the filename in a JSON response.
Open on GitHub → Explain another repo

← bottlepy on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.