Bottle is a WSGI-compliant single source file web framework with no external dependencies other than the Python standard library (stdlib).
Bottle is awesome for a few web development situations:
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.
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 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.
Configuring Python 3, Bottle and Gunicorn for Development on Ubuntu 16.04 LTS is a quick tutorial for getting an out-of-the-box default Ubuntu 16.04 image ready for Bottle development with Green Unicorn as the WSGI server.
Digital Ocean provides an extensive introductory post on Bottle.
Getting Started with Python, Bottle and Twilio SMS / MMS shows how to build a simple Bottle web application that can send and receive text and picture messages.
This tutorial provides a walkthrough for getting started with Bottle.
Developing With Bottle details how to create a basic application with Bottle.
The official Bottle tutorial provides a thorough view of basic concepts and features for the framework.
Running a Bottle app with Gunicorn shows how to execute a simple Bottle web app with Green Unicorn.
Here's a short code snippet for creating a RESTful API with Bottle and MongoDB.
This tutorial is another Bottle walkthrough for creating a RESTful web API.
BAM! A Web Framework "Short Stack" is a walkthrough of using Bottle, Apache and MongoDB to create a web application.
Bottle, full stack without Django does a nice job of connecting SQLAlchemy with Bottle and building an example application using the framework.
Using bottle.py in Production has some good tips on deploying a Bottle app to a production environment.
Jinja2 Templates and Bottle shows how to use Jinja instead of the built-in templating engine for Bottle page rendering.
How to build a web app using Bottle with Jinja2 in Google App Engine provides a tutorial for using Bottle on the Google App Engine platform-as-a-service.
Pattle is a pastebin clone built with Bottle.
Decanter is a library for structuring Bottle projects.
compare-python-web-frameworks provides an example application using Bottle as one of the implementations.
Download Bottle
or install via pip with pip install bottle
on your local development
machine.
Work through the official Bottle tutorial.
Start coding your Bottle app based on what you learned in the official tutorial plus reading open source example applications found above.
Move on to the deployment section to get your initial Bottle application on the web.
Searching for a complete, step-by-step deployment walkthrough? Learn more about The Full Stack Python Guide to Deployments book.