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.

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 for two emails per month with Python tutorials and Full Stack Python updates.

Sponsored By

Rollbar logo

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


Mapbox logo.

Easily build maps, search and navigation into your Python applications with Mapbox.


Real Python logo

Upgrade your Python skills by reading Real Python's awesome programming email newsletter.

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.
1. IntroductionLearning ProgrammingCore LanguageWhy Use Python?Python 2 or 3?Enterprise PythonPython CommunityCompanies using PythonBest Python ResourcesBest Python VideosBest Python Podcasts2. Development EnvironmentsText Editors & IDEsVimEmacsSublime TextPyCharmJupyter NotebookShellsBash shellZshPowerShellTerminal MultiplexerstmuxScreenPymuxEnvironment configurationApplication DependenciesVirtualenvsEnvironment variablesLocalhost tunnelsSource ControlGitMercurialApache SubversionHosted Source ControlGitHubBitBucketGitLab3. DataRelational DatabasesPostgreSQLMySQLSQLiteObject-relational MappersSQLAlchemyPeeweeDjango ORMSQLObjectPony ORMNoSQL Data StoresRedisMongoDBApache CassandraNeo4jData analysispandasNumPySciPyBokehd3.jsMatplotlibMarkdown4. Web DevelopmentWeb FrameworksDjangoFlaskBottlePyramidFalconMorepathSanicOther Web FrameworksTemplate EnginesJinja2MakoDjango TemplatesWeb DesignHTMLCascading Style Sheets (CSS)Responsive DesignMinificationCSS FrameworksBootstrapFoundationJavaScriptTask QueuesCeleryRedis Queue (RQ)DramatiqStatic Site GeneratorsPelicanLektorMkDocsTestingUnit TestingIntegration TestingCode MetricsDebuggingWebSocketsuvloopWeb APIsMicroservicesBotsAPI CreationAPI IntegrationTwilioSecurity5. DeploymentServersStatic ContentVirtual Private ServersPlatform-as-a-ServiceOperating SystemsUbuntuWeb ServersApache HTTP ServerNginxCaddyWSGI ServersGreen Unicorn (Gunicorn)Continuous IntegrationJenkinsConfiguration ManagementAnsibleDockerServerlessAWS LambdaGoogle Cloud Functions6. DevOpsMonitoringRollbarCachingLoggingWeb AnalyticsChange LogWhat Full Stack MeansAbout the AuthorFuture DirectionsPage Statuses ...or view all topics.

Matt Makai 2012-2018