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 ...
Flask
Otro beneficio es que Python tiene bibliotecas poderosas que hacen que el desarrollo web sea más fácil. Estas bibliotecas incluyen Django, <anchor>Flask</anchor>, y Bottle. Proporcionan herramientas útiles para construir sitios web y aplicaciones.
Welcome to Flask — Flask Documentation (2.1.x)
Welcome to Flask — Flask Documentation (2.1.x)

### Navigation

- [index](genindex/ "General Index")
- [modules](py-modindex/ "Python Module Index") \|
- [next](foreword/ "Foreword") \|
- Flask Documentation (2.1.x) »
- Welcome to Flask

**Warning:** This is an old version. The latest stable version is [Version 2.2.x](./../2.2.x/).

# Welcome to Flask [¶](\#welcome-to-flask "Permalink to this headline")

[![Flask: web development, one drop at a time](_images/flask-logo.png)](https://palletsprojects.com/p/flask/)

Welcome to Flask’s documentation. Get started with [Installation](installation/)
and then get an overview with the [Quickstart](quickstart/). There is also a
more detailed [Tutorial](tutorial/) that shows how to create a small but
complete application with Flask. Common patterns are described in the
[Patterns for Flask](patterns/) section. The rest of the docs describe each
component of Flask in detail, with a full reference in the [API](api/)
section.

Flask depends on the [Jinja](https://www.palletsprojects.com/p/jinja/) template engine and the [Werkzeug](https://www.palletsprojects.com/p/werkzeug/) WSGI
toolkit. The documentation for these libraries can be found at:

- [Jinja documentation](https://jinja.palletsprojects.com/)

- [Werkzeug documentation](https://werkzeug.palletsprojects.com/)


## User’s Guide [¶](\#user-s-guide "Permalink to this headline")

This part of the documentation, which is mostly prose, begins with some
background information about Flask, then focuses on step-by-step
instructions for web development with Flask.

- [Foreword](foreword/)
  - [What does “micro” mean?](foreword/#what-does-micro-mean)
  - [Configuration and Conventions](foreword/#configuration-and-conventions)
  - [Growing with Flask](foreword/#growing-with-flask)
- [Foreword for Experienced Programmers](advanced_foreword/)
  - [Thread-Locals in Flask](advanced_foreword/#thread-locals-in-flask)
  - [Develop for the Web with Caution](advanced_foreword/#develop-for-the-web-with-caution)
- [Installation](installation/)
  - [Python Version](installation/#python-version)
  - [Dependencies](installation/#dependencies)
  - [Virtual environments](installation/#virtual-environments)
  - [Install Flask](installation/#install-flask)
- [Quickstart](quickstart/)
  - [A Minimal Application](quickstart/#a-minimal-application)
  - [What to do if the Server does not Start](quickstart/#what-to-do-if-the-server-does-not-start)
  - [Debug Mode](quickstart/#debug-mode)
  - [HTML Escaping](quickstart/#html-escaping)
  - [Routing](quickstart/#routing)
  - [Static Files](quickstart/#static-files)
  - [Rendering Templates](quickstart/#rendering-templates)
  - [Accessing Request Data](quickstart/#accessing-request-data)
  - [Redirects and Errors](quickstart/#redirects-and-errors)
  - [About Responses](quickstart/#about-responses)
  - [Sessions](quickstart/#sessions)
  - [Message Flashing](quickstart/#message-flashing)
  - [Logging](quickstart/#logging)
  - [Hooking in WSGI Middleware](quickstart/#hooking-in-wsgi-middleware)
  - [Using Flask Extensions](quickstart/#using-flask-extensions)
  - [Deploying to a Web Server](quickstart/#deploying-to-a-web-server)
- [Tutorial](tutorial/)
  - [Project Layout](tutorial/layout/)
  - [Application Setup](tutorial/factory/)
  - [Define and Access the Database](tutorial/database/)
  - [Blueprints and Views](tutorial/views/)
  - [Templates](tutorial/templates/)
  - [Static Files](tutorial/static/)
  - [Blog Blueprint](tutorial/blog/)
  - [Make the Project Installable](tutorial/install/)
  - [Test Coverage](tutorial/tests/)
  - [Deploy to Production](tutorial/deploy/)
  - [Keep Developing!](tutorial/next/)
- [Templates](templating/)
  - [Jinja Setup](templating/#jinja-setup)
  - [Standard Context](templating/#standard-context)
  - [Controlling Autoescaping](templating/#controlling-autoescaping)
  - [Registering Filters](templating/#registering-filters)
  - [Context Processors](templating/#context-processors)
- [Testing Flask Applications](testing/)
  - [Identifying Tests](testing/#identifying-tests)
  - [Fixtures](testing/#fixtures)
  - [Sending Requests with the Test Client](testing/#sending-requests-with-the-test-client)
  - [Following Redirects](testing/#following-redirects)
  - [Accessing and Modifying the Session](testing/#accessing-and-modifying-the-session)
  - [Running Commands with the CLI Runner](testing/#running-commands-with-the-cli-runner)
  - [Tests that depend on an Active Context](testing/#tests-that-depend-on-an-active-context)
- [Handling Application Errors](errorhandling/)
  - [Error Logging Tools](errorhandling/#error-logging-tools)
  - [Error Handlers](errorhandling/#error-handlers)
  - [Custom Error Pages](errorhandling/#custom-error-pages)
  - [Blueprint Error Handlers](errorhandling/#blueprint-error-handlers)
  - [Returning API Errors as JSON](errorhandling/#returning-api-errors-as-json)
  - [Logging](errorhandling/#logging)
  - [Debugging](errorhandling/#debugging)
- [Debugging Application Errors](debugging/)
  - [In Production](debugging/#in-production)
  - [The Built-In Debugger](debugging/#the-built-in-debugger)
  - [External Debuggers](debugging/#external-debuggers)
- [Logging](logging/)
  - [Basic Configuration](logging/#basic-configuration)
  - [Email Errors to Admins](logging/#email-errors-to-admins)
  - [Injecting Request Information](logging/#injecting-request-information)
  - [Other Libraries](logging/#other-libraries)
- [Configuration Handling](config/)
  - [Configuration Basics](config/#configuration-basics)
  - [Environment and Debug Features](config/#environment-and-debug-features)
  - [Builtin Configuration Values](config/#builtin-configuration-values)
  - [Configuring from Python Files](config/#configuring-from-python-files)
  - [Configuring from Data Files](config/#configuring-from-data-files)
  - [Configuring from Environment Variables](config/#configuring-from-environment-variables)
  - [Configuration Best Practices](config/#configuration-best-practices)
  - [Development / Production](config/#development-production)
  - [Instance Folders](config/#instance-folders)
- [Signals](signals/)
  - [Subscribing to Signals](signals/#subscribing-to-signals)
  - [Creating Signals](signals/#creating-signals)
  - [Sending Signals](signals/#sending-signals)
  - [Signals and Flask’s Request Context](signals/#signals-and-flask-s-request-context)
  - [Decorator Based Signal Subscriptions](signals/#decorator-based-signal-subscriptions)
  - [Core Signals](signals/#core-signals)
- [Pluggable Views](views/)
  - [Basic Principle](views/#basic-principle)
  - [Method Hints](views/#method-hints)
  - [Method Based Dispatching](views/#method-based-dispatching)
  - [Decorating Views](views/#decorating-views)
  - [Method Views for APIs](views/#method-views-for-apis)
- [The Application Context](appcontext/)
  - [Purpose of the Context](appcontext/#purpose-of-the-context)
  - [Lifetime of the Context](appcontext/#lifetime-of-the-context)
  - [Manually Push a Context](appcontext/#manually-push-a-context)
  - [Storing Data](appcontext/#storing-data)
  - [Events and Signals](appcontext/#events-and-signals)
- [The Request Context](reqcontext/)
  - [Purpose of the Context](reqcontext/#purpose-of-the-context)
  - [Lifetime of the Context](reqcontext/#lifetime-of-the-context)
  - [Manually Push a Context](reqcontext/#manually-push-a-context)
  - [How the Context Works](reqcontext/#how-the-context-works)
  - [Callbacks and Errors](reqcontext/#callbacks-and-errors)
  - [Context Preservation on Error](reqcontext/#context-preservation-on-error)
  - [Notes On Proxies](reqcontext/#notes-on-proxies)
- [Modular Applications with Blueprints](blueprints/)
  - [Why Blueprints?](blueprints/#why-blueprints)
  - [The Concept of Blueprints](blueprints/#the-concept-of-blueprints)
  - [My First Blueprint](blueprints/#my-first-blueprint)
  - [Registering Blueprints](blueprints/#registering-blueprints)
  - [Nesting Blueprints](blueprints/#nesting-blueprints)
  - [Blueprint Resources](blueprints/#blueprint-resources)
  - [Building URLs](blueprints/#building-urls)
  - [Blueprint Error Handlers](blueprints/#blueprint-error-handlers)
- [Extensions](extensions/)
  - [Finding Extensions](extensions/#finding-extensions)
  - [Using Extensions](extensions/#using-extensions)
  - [Building Extensions](extensions/#building-extensions)
- [Command Line Interface](cli/)
  - [Application Discovery](cli/#application-discovery)
  - [Run the Development Server](cli/#run-the-development-server)
  - [Open a Shell](cli/#open-a-shell)
  - [Environments](cli/#environments)
  - [Debug Mode](cli/#debug-mode)
  - [Environment Variables From dotenv](cli/#environment-variables-from-dotenv)
  - [Environment Variables From virtualenv](cli/#environment-variables-from-virtualenv)
  - [Custom Commands](cli/#custom-commands)
  - [Plugins](cli/#plugins)
  - [Custom Scripts](cli/#custom-scripts)
  - [PyCharm Integration](cli/#pycharm-integration)
- [Development Server](server/)
  - [Command Line](server/#command-line)
  - [In Code](server/#in-code)
- [Working with the Shell](shell/)
  - [Command Line Interface](shell/#command-line-interface)
  - [Creating a Request Context](shell/#creating-a-request-context)
  - [Firing Before/After Request](shell/#firing-before-after-request)
  - [Further Improving the Shell Experience](shell/#further-improving-the-shell-experience)
- [Patterns for Flask](patterns/)
  - [Large Applications as Packages](patterns/packages/)
  - [Application Factories](patterns/appfactories/)
  - [Application Dispatching](patterns/appdispatch/)
  - [Using URL Processors](patterns/urlprocessors/)
  - [Deploying with Setuptools](patterns/distribute/)
  - [Deploying with Fabric](patterns/fabric/)
  - [Using SQLite 3 with Flask](patterns/sqlite3/)
  - [SQLAlchemy in Flask](patterns/sqlalchemy/)
  - [Uploading Files](patterns/fileuploads/)
  - [Caching](patterns/caching/)
  - [View Decorators](patterns/viewdecorators/)
  - [Form Validation with WTForms](patterns/wtforms/)
  - [Template Inheritance](patterns/templateinheritance/)
  - [Message Flashing](patterns/flashing/)
  - [JavaScript, `fetch`, and JSON](patterns/javascript/)
  - [Lazily Loading Views](patterns/lazyloading/)
  - [MongoDB with MongoEngine](patterns/mongoengine/)
  - [Adding a favicon](patterns/favicon/)
  - [Streaming Contents](patterns/streaming/)
  - [Deferred Request Callbacks](patterns/deferredcallbacks/)
  - [Adding HTTP Method Overrides](patterns/methodoverrides/)
  - [Request Content Checksums](patterns/requestchecksum/)
  - [Celery Background Tasks](patterns/celery/)
  - [Subclassing Flask](patterns/subclassing/)
  - [Single-Page Applications](patterns/singlepageapplications/)
- [Deploying to Production](deploying/)
  - [Self-Hosted Options](deploying/#self-hosted-options)
  - [Hosting Platforms](deploying/#hosting-platforms)
- [Using `async` and `await`](async-await/)
  - [Performance](async-await/#performance)
  - [Background tasks](async-await/#background-tasks)
  - [When to use Quart instead](async-await/#when-to-use-quart-instead)
  - [Extensions](async-await/#extensions)
  - [Other event loops](async-await/#other-event-loops)

## API Reference [¶](\#api-reference "Permalink to this headline")

If you are looking for information on a specific function, class or
method, this part of the documentation is for you.

- [API](api/)
  - [Application Object](api/#application-object)
  - [Blueprint Objects](api/#blueprint-objects)
  - [Incoming Request Data](api/#incoming-request-data)
  - [Response Objects](api/#response-objects)
  - [Sessions](api/#sessions)
  - [Session Interface](api/#session-interface)
  - [Test Client](api/#test-client)
  - [Test CLI Runner](api/#test-cli-runner)
  - [Application Globals](api/#application-globals)
  - [Useful Functions and Classes](api/#useful-functions-and-classes)
  - [Message Flashing](api/#message-flashing)
  - [JSON Support](api/#module-flask.json)
  - [Template Rendering](api/#template-rendering)
  - [Configuration](api/#configuration)
  - [Stream Helpers](api/#stream-helpers)
  - [Useful Internals](api/#useful-internals)
  - [Signals](api/#signals)
  - [Class-Based Views](api/#class-based-views)
  - [URL Route Registrations](api/#url-route-registrations)
  - [View Function Options](api/#view-function-options)
  - [Command Line Interface](api/#command-line-interface)

## Additional Notes [¶](\#additional-notes "Permalink to this headline")

Design notes, legal information and changelog are here for the interested.

- [Design Decisions in Flask](design/)
  - [The Explicit Application Object](design/#the-explicit-application-object)
  - [The Routing System](design/#the-routing-system)
  - [One Template Engine](design/#one-template-engine)
  - [Micro with Dependencies](design/#micro-with-dependencies)
  - [Thread Locals](design/#thread-locals)
  - [Async/await and ASGI support](design/#async-await-and-asgi-support)
  - [What Flask is, What Flask is Not](design/#what-flask-is-what-flask-is-not)
- [HTML/XHTML FAQ](htmlfaq/)
  - [History of XHTML](htmlfaq/#history-of-xhtml)
  - [History of HTML5](htmlfaq/#history-of-html5)
  - [HTML versus XHTML](htmlfaq/#html-versus-xhtml)
  - [What does “strict” mean?](htmlfaq/#what-does-strict-mean)
  - [New technologies in HTML5](htmlfaq/#new-technologies-in-html5)
  - [What should be used?](htmlfaq/#what-should-be-used)
- [Security Considerations](security/)
  - [Cross-Site Scripting (XSS)](security/#cross-site-scripting-xss)
  - [Cross-Site Request Forgery (CSRF)](security/#cross-site-request-forgery-csrf)
  - [JSON Security](security/#json-security)
  - [Security Headers](security/#security-headers)
  - [Copy/Paste to Terminal](security/#copy-paste-to-terminal)
- [Flask Extension Development](extensiondev/)
  - [Naming](extensiondev/#naming)
  - [The Extension Class and Initialization](extensiondev/#the-extension-class-and-initialization)
  - [Adding Behavior](extensiondev/#adding-behavior)
  - [Configuration Techniques](extensiondev/#configuration-techniques)
  - [Data During a Request](extensiondev/#data-during-a-request)
  - [Views and Models](extensiondev/#views-and-models)
  - [Recommended Extension Guidelines](extensiondev/#recommended-extension-guidelines)
- [How to contribute to Flask](contributing/)
  - [Support questions](contributing/#support-questions)
  - [Reporting issues](contributing/#reporting-issues)
  - [Submitting patches](contributing/#submitting-patches)
- [License](license/)
  - [BSD-3-Clause Source License](license/#bsd-3-clause-source-license)
  - [Artwork License](license/#artwork-license)
- [Changes](changes/)
  - [Version 2.1.3](changes/#version-2-1-3)
  - [Version 2.1.2](changes/#version-2-1-2)
  - [Version 2.1.1](changes/#version-2-1-1)
  - [Version 2.1.0](changes/#version-2-1-0)
  - [Version 2.0.3](changes/#version-2-0-3)
  - [Version 2.0.2](changes/#version-2-0-2)
  - [Version 2.0.1](changes/#version-2-0-1)
  - [Version 2.0.0](changes/#version-2-0-0)
  - [Version 1.1.4](changes/#version-1-1-4)
  - [Version 1.1.3](changes/#version-1-1-3)
  - [Version 1.1.2](changes/#version-1-1-2)
  - [Version 1.1.1](changes/#version-1-1-1)
  - [Version 1.1.0](changes/#version-1-1-0)
  - [Version 1.0.4](changes/#version-1-0-4)
  - [Version 1.0.3](changes/#version-1-0-3)
  - [Version 1.0.2](changes/#version-1-0-2)
  - [Version 1.0.1](changes/#version-1-0-1)
  - [Version 1.0](changes/#version-1-0)
  - [Version 0.12.5](changes/#version-0-12-5)
  - [Version 0.12.4](changes/#version-0-12-4)
  - [Version 0.12.3](changes/#version-0-12-3)
  - [Version 0.12.2](changes/#version-0-12-2)
  - [Version 0.12.1](changes/#version-0-12-1)
  - [Version 0.12](changes/#version-0-12)
  - [Version 0.11.1](changes/#version-0-11-1)
  - [Version 0.11](changes/#version-0-11)
  - [Version 0.10.1](changes/#version-0-10-1)
  - [Version 0.10](changes/#version-0-10)
  - [Version 0.9](changes/#version-0-9)
  - [Version 0.8.1](changes/#version-0-8-1)
  - [Version 0.8](changes/#version-0-8)
  - [Version 0.7.2](changes/#version-0-7-2)
  - [Version 0.7.1](changes/#version-0-7-1)
  - [Version 0.7](changes/#version-0-7)
  - [Version 0.6.1](changes/#version-0-6-1)
  - [Version 0.6](changes/#version-0-6)
  - [Version 0.5.2](changes/#version-0-5-2)
  - [Version 0.5.1](changes/#version-0-5-1)
  - [Version 0.5](changes/#version-0-5)
  - [Version 0.4](changes/#version-0-4)
  - [Version 0.3.1](changes/#version-0-3-1)
  - [Version 0.3](changes/#version-0-3)
  - [Version 0.2](changes/#version-0-2)
  - [Version 0.1](changes/#version-0-1)

### Project Links

- [Donate](https://palletsprojects.com/donate)
- [PyPI Releases](https://pypi.org/project/Flask/)
- [Source Code](https://github.com/pallets/flask/)
- [Issue Tracker](https://github.com/pallets/flask/issues/)
- [Website](https://palletsprojects.com/p/flask/)
- [Twitter](https://twitter.com/PalletsTeam)
- [Chat](https://discord.gg/pallets)

### Contents

- Welcome to Flask
  - [User’s Guide](#user-s-guide)
  - [API Reference](#api-reference)
  - [Additional Notes](#additional-notes)

### Quick search

© Copyright 2010 Pallets.
Created using [Sphinx](https://www.sphinx-doc.org/) 4.5.0.