Bottle

Bottle (source code) 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.

你接下来要学什么?

我已经创建了一个 Python Web 应用,那我该如何部署呢?

我的应用运行起来了,但看起来很糟糕。如何设置用户界面的样式?

还有哪些其他 Python Web 框架?

Sign up for a monthly email with Full Stack Python tutorials. No spam ever.

Sponsored By

Rollbar logo

Fix errors in your Python code before your users see them by monitoring with Rollbar.

Learn More Python

Introduction to Ansible video course logo.

Deploy web apps with the Ansible configuration management tool.


TestDriven logo

Build microservices with Docker, Flask & React in this great course.

Full Stack Python

Full Stack Python is an open book that explains concepts in plain language and provides helpful resources for those topics.
Updates via newsletter, Twitter & Facebook.