Fork me on GitHub

Bottle

Bottle is a WSGI-compliant single source file web framework with no external dependencies other than the Python standard library (stdlib).

Official Bottle logo.

Should I use Bottle for web development?

Bottle is awesome for a few web development situations:

  1. Prototyping ideas
  2. Learning how web frameworks are built
  3. Building and running simple personal web applications

Prototyping

Prototyping simple ideas is often easier with Bottle than a more opinionated web framework like Django because Django projects start with a significant amount of boilerplate code. The Model-View-Template structure for Django apps within projects makes maintaining projects easier, but it can be cumbersome on starter projects where you're just playing with random ideas so you aren't worried about your application's long-term code structure.

Learning about frameworks

Bottle is contained within a single large source file named bottle.py so it provides great reading when learning how WSGI web frameworks work. Everything you need to learn about how your web application's code connects with the Bottle framework is contained within that single source code.

Personal projects

Personal projects can be deployed with Bottle as the only dependency. If you've never performed a Python web app deployment before, the number of concepts and steps can be daunting. By packaging bottle.py with your app's source code, you can skip some of the steps to more easily get your web application up and running.

Bottle is an implementation of the web frameworks concept. Learn how these pieces fit together in the web development chapter or view the table of contents for all topics.

Bottle resources

Open source Bottle example projects

Bottle framework learning checklist

  1. Download Bottle or install via pip with pip install bottle on your local development machine.

  2. Work through the official Bottle tutorial.

  3. Start coding your Bottle app based on what you learned in the official tutorial plus reading open source example applications found above.

  4. Move on to the deployment section to get your initial Bottle application on the web.

What do you want to learn next?

I've built a Python web app, now how do I deploy it?

My app runs but looks awful. How do I style the user interface?

What other Python web frameworks exist?

Sign up here to receive a monthly email with major updates to this site, tutorials and discount codes for Python books.