Cómo Aprender Python (Rápido & Gratis) - DreamHost
El sitio web oficial de Python ofrece varios recursos, guías y tutoriales que pueden mostrarte los conceptos básicos de los lenguajes de ...
Bottle
Otro beneficio es que Python tiene bibliotecas poderosas que hacen que el desarrollo web sea más fácil. Estas bibliotecas incluyen Django, Flask, y <anchor>Bottle</anchor>. Proporcionan herramientas útiles para construir sitios web y aplicaciones.
Bottle: Python Web Framework — Bottle 0.14-dev documentation
Bottle: Python Web Framework — Bottle 0.14-dev documentation

# Bottle: Python Web Framework [¶](\#bottle-python-web-framework "Link to this heading")

Bottle is a fast, simple and lightweight [WSGI](https://peps.python.org/pep-3333/) micro web-framework for [Python](http://python.org/). It is distributed as a single file module and has no dependencies other than the [Python Standard Library](http://docs.python.org/library/).

- **Routing:** Requests to function-call mapping with support for clean and dynamic URLs.

- **Templates:** Fast and pythonic [built-in template engine](tutorial.html#tutorial-templates) and support for [mako](http://www.makotemplates.org/), [jinja2](https://jinja.palletsprojects.com/) and [cheetah](http://www.cheetahtemplate.org/) templates.

- **Utilities:** Convenient access to form data, file uploads, cookies, headers and other HTTP features.

- **Server:** Built-in HTTP development server and support for a wide range of [WSGI](https://peps.python.org/pep-3333/) capable HTTP server (e.g. [gunicorn](https://gunicorn.org/), [paste](https://pythonpaste.readthedocs.io/) or [cheroot](https://cheroot.cherrypy.dev/)).


Example: “Hello World” in a bottle

```
from bottle import route, run, template

@route('/hello/<name>')
def index(name):
    return template('<b>Hello {{name}}</b>!', name=name)

run(host='localhost', port=8080)

```

Run this script or paste it into a Python console, then point your browser to [http://localhost:8080/hello/world](http://localhost:8080/hello/world). That’s it.

## Download and Install [¶](\#download-and-install "Link to this heading")

Install the latest stable release with `pip install bottle` or download [bottle.py](https://github.com/bottlepy/bottle/raw/master/bottle.py) (unstable) into your project directory. There are no hard [\[1\]](#id3) dependencies other than the Python standard library.

## Dead Snakes [¶](\#dead-snakes "Link to this heading")

Bottle up to version 0.12 supported an absurd number of python versions, some of which reached their end-of-life well over a decade ago. Starting with Bottle 0.13 we will ensure compatibility with [maintained versions of Python](https://devguide.python.org/versions/) but drop support for “dead snakes” with each new bottle release. If you are in the unfortunate position to have to rely on such a truly ancient version of Python, just stick with a compatible bottle release. Everyone else should update regularly to benefit from new features and improvements.

Python Support Matrix [¶](#id4 "Link to this table")

Bottle Version

Python 2

Python 3

0.12

2.5, 2.6, 2.7

3.2 - 3.12

0.13

2.7

3.8 - 3.x

1.0 (planned)

_dropped_

3.8 - 3.x

## Documentation [¶](\#documentation "Link to this heading")

Getting Started

- [User’s Guide](tutorial.html)
  - [Installation](tutorial.html#installation)
  - [Hello World!](tutorial.html#hello-world)
  - [Request Routing](tutorial.html#request-routing)
  - [Serving Assets](tutorial.html#serving-assets)
  - [Generating content](tutorial.html#generating-content)
  - [Error handling](tutorial.html#error-handling)
  - [Request Data](tutorial.html#request-data)
  - [Templates](tutorial.html#templates)
  - [Structuring Applications](tutorial.html#structuring-applications)
  - [Glossary](tutorial.html#glossary)
- [API Reference](api.html)
  - [Global functions](api.html#global-functions)
  - [Global decorators](api.html#global-decorators)
  - [Request Context](api.html#request-context)
  - [Helper Functions](api.html#helper-functions)
  - [Exceptions](api.html#exceptions)
  - [The `Bottle` Class](api.html#the-bottle-class)
  - [The `Request` Object](api.html#the-request-object)
  - [The `Response` Object](api.html#the-response-object)
  - [Data Structures](api.html#data-structures)
  - [Request routing](api.html#request-routing)
  - [Templating](api.html#templating)
  - [HTTP utilities](api.html#http-utilities)
  - [Misc utilities](api.html#misc-utilities)
- [Release Notes](changelog.html)
  - [Release 0.14 (in development)](changelog.html#release-0-14-in-development)
  - [Release 0.13](changelog.html#release-0-13)
  - [Release 0.12](changelog.html#release-0-12)
  - [Release 0.11](changelog.html#release-0-11)
  - [Release 0.10](changelog.html#release-0-10)
  - [Release 0.9](changelog.html#release-0-9)
  - [Release 0.8](changelog.html#release-0-8)
- [F.A.Q.](faq.html)
  - [General questions](faq.html#general-questions)
  - [Common errors and pitfalls](faq.html#common-errors-and-pitfalls)
  - [Recieps for common tasks](faq.html#recieps-for-common-tasks)

Advanced Topics

- [Request Routing](routing.html)
  - [Rule Syntax](routing.html#rule-syntax)
  - [Wildcard Filters](routing.html#wildcard-filters)
  - [Legacy Syntax](routing.html#legacy-syntax)
  - [Explicit routing configuration](routing.html#explicit-routing-configuration)
- [Configuration](configuration.html)
  - [Configuration Basics](configuration.html#configuration-basics)
  - [Naming Convention](configuration.html#naming-convention)
  - [Load configuration from a File](configuration.html#load-configuration-from-a-file)
  - [Load configuration from a python module](configuration.html#load-configuration-from-a-python-module)
  - [Loading configuration from a `dict`](configuration.html#loading-configuration-from-a-dict)
  - [Listening to configuration changes](configuration.html#listening-to-configuration-changes)
  - [Filters and other Meta Data](configuration.html#filters-and-other-meta-data)
  - [API Documentation](configuration.html#api-documentation)
- [SimpleTemplate](stpl.html)
  - [`SimpleTemplate` Syntax](stpl.html#simpletemplate-syntax)
  - [Template Functions](stpl.html#template-functions)
  - [`SimpleTemplate` API](stpl.html#simpletemplate-api)
- [Deployment](deployment.html)
  - [Scaling for Production](deployment.html#scaling-for-production)
- [Asynchronous Applications](async.html)
  - [The Limits of Synchronous WSGI](async.html#the-limits-of-synchronous-wsgi)
  - [Greenlets to the rescue](async.html#greenlets-to-the-rescue)
  - [Event Callbacks](async.html#event-callbacks)
  - [Finally: WebSockets](async.html#finally-websockets)

Plugins

- [Using Plugins](plugins/index.html)
  - [Plugin Basics](plugins/index.html#plugin-basics)
  - [Managing Plugins](plugins/index.html#managing-plugins)
  - [Configuring Plugins](plugins/index.html#configuring-plugins)
- [Writing Plugins](plugins/dev.html)
  - [Plugin API](plugins/dev.html#plugin-api)
  - [The Route Context](plugins/dev.html#the-route-context)
  - [Runtime optimizations](plugins/dev.html#runtime-optimizations)
  - [Common patterns](plugins/dev.html#common-patterns)
  - [Plugin Example: SQLitePlugin](plugins/dev.html#plugin-example-sqliteplugin)
- [3rd Party Plugins](plugins/list.html)

Additional Notes

- [Todo-List Example](tutorial_app.html)
  - [Goals](tutorial_app.html#goals)
  - [Before We Start…](tutorial_app.html#before-we-start)
  - [Using Bottle for a Web-Based ToDo List](tutorial_app.html#using-bottle-for-a-web-based-todo-list)
  - [Server Setup](tutorial_app.html#server-setup)
  - [Final Words](tutorial_app.html#final-words)
  - [Complete Example Listing](tutorial_app.html#complete-example-listing)

Development

- [Developer Notes](development.html)
  - [Get involved](development.html#get-involved)
  - [Get the Sources](development.html#get-the-sources)
  - [Releases and Updates](development.html#releases-and-updates)
  - [Repository Structure](development.html#repository-structure)
  - [Submitting Patches](development.html#submitting-patches)
- [Contributors](contributors.html)

## License [¶](\#license "Link to this heading")

Code and documentation are available according to the MIT License:

```
Copyright (c) 2009-2024, Marcel Hellkamp.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

```

The Bottle logo however is _NOT_ covered by that license. It is allowed to
use the logo as a link to the bottle homepage or in direct context with
the unmodified library. In all other cases please ask first.

Footnotes

\[ [1](#id2)\]

Usage of the template or server adapter classes requires the corresponding template or server modules.

![Logo of Bottle](_static/logo_nav.png)

Bottle is a fast, simple and lightweight WSGI micro web-framework for Python.

### Table of Contents

Getting Started

- [User’s Guide](tutorial.html)
- [API Reference](api.html)
- [Release Notes](changelog.html)
- [F.A.Q.](faq.html)

Advanced Topics

- [Request Routing](routing.html)
- [Configuration](configuration.html)
- [SimpleTemplate](stpl.html)
- [Deployment](deployment.html)
- [Asynchronous Applications](async.html)

Plugins

- [Using Plugins](plugins/index.html)
- [Writing Plugins](plugins/dev.html)
- [3rd Party Plugins](plugins/list.html)

Additional Notes

- [Todo-List Example](tutorial_app.html)

Development

- [Developer Notes](development.html)
- [Contributors](contributors.html)

### Releases

This is the documentation for **Bottle-0.14-dev**, which is
not released yet.

- [Bottle dev](/docs/dev/) (next)
- [Bottle 0.13](/docs/0.13/) (stable)
- [Bottle 0.12](/docs/0.12/) (LTS)

### Links

- [Documentation](https://bottlepy.org)
- [Python Package Index](https://pypi.python.org/pypi/bottle)
- [Sources at GitHub](https://github.com/bottlepy/bottle)
- [Mailing list](https://groups.google.de/group/bottlepy)

### Quick search

© [Copyright](##license) 2009-2024, Marcel Hellkamp