Bottle (source code) 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.
Check out these Full Stack Python Bottle tutorials that'll teach you how to write a few small but very useful Bottle web apps:
Digital Ocean provides an extensive introductory post on Bottle.
First Steps with Python and Bottle is a quick 4 minute introduction that I created for developers so they can get the simplest possible Bottle web app running. There is also a companion blog post with the code.
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. How to Make and Receive Phone Calls with Python, Bottle and Twilio Voice is a similar beginner's tutorial for handling phone calls with a Bottle app using Twilio.
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.
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.
Python patterns contains a setup that combines Bottle, Celery and Peewee as the developer's choice for backend web development. The developer also uses Vim as the primary editor for working with Bottle.
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.