Node.js vs Python: Qual È la Tecnologia Migliore per la Tua Web App?
Python funziona diversamente rispetto a Node.js. In primo luogo, Python non converte direttamente il suo codice in codice macchina. Invece, ...
Flask
Python supporta anche lo sviluppo web con alcuni framework come Django e <anchor>Flask</anchor>. È possibile creare applicazioni desktop e aziendali o anche giochi con Python.
Welcome to Flask — Flask Documentation (1.1.x)
Welcome to Flask — Flask Documentation (1.1.x)

### Navigation

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

**Warning:** This is an old version. The latest stable version is [Version 2.0.x](./../2.0.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/#installation)
and then get an overview with the [Quickstart](quickstart/#quickstart). There is also a
more detailed [Tutorial](tutorial/#tutorial) that shows how to create a small but
complete application with Flask. Common patterns are described in the
[Patterns for Flask](patterns/#patterns) section. The rest of the docs describe each component of
Flask in detail, with a full reference in the [API](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](http://jinja.pocoo.org/docs)

- [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)
  - [Install virtualenv](installation/#install-virtualenv)
- [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)
  - [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)
  - [Standard Filters](templating/#standard-filters)
  - [Controlling Autoescaping](templating/#controlling-autoescaping)
  - [Registering Filters](templating/#registering-filters)
  - [Context Processors](templating/#context-processors)
- [Testing Flask Applications](testing/)
  - [The Application](testing/#the-application)
  - [The Testing Skeleton](testing/#the-testing-skeleton)
  - [The First Test](testing/#the-first-test)
  - [Logging In and Out](testing/#logging-in-and-out)
  - [Test Adding Messages](testing/#test-adding-messages)
  - [Other Testing Tricks](testing/#other-testing-tricks)
  - [Faking Resources and Context](testing/#faking-resources-and-context)
  - [Keeping the Context Around](testing/#keeping-the-context-around)
  - [Accessing and Modifying Sessions](testing/#accessing-and-modifying-sessions)
  - [Testing JSON APIs](testing/#testing-json-apis)
  - [Testing CLI Commands](testing/#testing-cli-commands)
- [Application Errors](errorhandling/)
  - [Error Logging Tools](errorhandling/#error-logging-tools)
  - [Error handlers](errorhandling/#error-handlers)
  - [Logging](errorhandling/#logging)
- [Debugging Application Errors](errorhandling/#debugging-application-errors)
  - [When in Doubt, Run Manually](errorhandling/#when-in-doubt-run-manually)
  - [Working with Debuggers](errorhandling/#working-with-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 Files](config/#configuring-from-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)
  - [Blueprint Resources](blueprints/#blueprint-resources)
  - [Building URLs](blueprints/#building-urls)
  - [Error Handlers](blueprints/#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/)
  - [Larger Applications](patterns/packages/)
  - [Application Factories](patterns/appfactories/)
  - [Application Dispatching](patterns/appdispatch/)
  - [Implementing API Exceptions](patterns/apierrors/)
  - [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/)
  - [AJAX with jQuery](patterns/jquery/)
  - [Custom Error Pages](patterns/errorpages/)
  - [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/)
- [Deployment Options](deploying/)
  - [Hosted options](deploying/#hosted-options)
  - [Self-hosted options](deploying/#self-hosted-options)
- [Becoming Big](becomingbig/)
  - [Read the Source.](becomingbig/#read-the-source)
  - [Hook. Extend.](becomingbig/#hook-extend)
  - [Subclass.](becomingbig/#subclass)
  - [Wrap with middleware.](becomingbig/#wrap-with-middleware)
  - [Fork.](becomingbig/#fork)
  - [Scale like a pro.](becomingbig/#scale-like-a-pro)
  - [Discuss with the community.](becomingbig/#discuss-with-the-community)

## 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)
  - [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)
- [Unicode in Flask](unicode/)
  - [Automatic Conversion](unicode/#automatic-conversion)
  - [The Golden Rule](unicode/#the-golden-rule)
  - [Encoding and Decoding Yourself](unicode/#encoding-and-decoding-yourself)
  - [Configuring Editors](unicode/#configuring-editors)
- [Flask Extension Development](extensiondev/)
  - [Anatomy of an Extension](extensiondev/#anatomy-of-an-extension)
  - [“Hello Flaskext!”](extensiondev/#hello-flaskext)
  - [Initializing Extensions](extensiondev/#initializing-extensions)
  - [The Extension Code](extensiondev/#the-extension-code)
  - [Using \_app\_ctx\_stack](extensiondev/#using-app-ctx-stack)
  - [Learn from Others](extensiondev/#learn-from-others)
  - [Approved Extensions](extensiondev/#approved-extensions)
- [Pocoo Styleguide](styleguide/)
  - [General Layout](styleguide/#general-layout)
  - [Expressions and Statements](styleguide/#expressions-and-statements)
  - [Naming Conventions](styleguide/#naming-conventions)
  - [Docstrings](styleguide/#docstrings)
  - [Comments](styleguide/#comments)
- [Upgrading to Newer Releases](upgrading/)
  - [Version 0.12](upgrading/#version-0-12)
  - [Version 0.11](upgrading/#version-0-11)
  - [Version 0.10](upgrading/#version-0-10)
  - [Version 0.9](upgrading/#version-0-9)
  - [Version 0.8](upgrading/#version-0-8)
  - [Version 0.7](upgrading/#version-0-7)
  - [Version 0.6](upgrading/#version-0-6)
  - [Version 0.5](upgrading/#version-0-5)
  - [Version 0.4](upgrading/#version-0-4)
  - [Version 0.3](upgrading/#version-0-3)
- [Changelog](changelog/)
  - [Version 1.1.4](changelog/#version-1-1-4)
  - [Version 1.1.3](changelog/#version-1-1-3)
  - [Version 1.1.2](changelog/#version-1-1-2)
  - [Version 1.1.1](changelog/#version-1-1-1)
  - [Version 1.1.0](changelog/#version-1-1-0)
  - [Version 1.0.4](changelog/#version-1-0-4)
  - [Version 1.0.3](changelog/#version-1-0-3)
  - [Version 1.0.2](changelog/#version-1-0-2)
  - [Version 1.0.1](changelog/#version-1-0-1)
  - [Version 1.0](changelog/#version-1-0)
  - [Version 0.12.5](changelog/#version-0-12-5)
  - [Version 0.12.4](changelog/#version-0-12-4)
  - [Version 0.12.3](changelog/#version-0-12-3)
  - [Version 0.12.2](changelog/#version-0-12-2)
  - [Version 0.12.1](changelog/#version-0-12-1)
  - [Version 0.12](changelog/#version-0-12)
  - [Version 0.11.1](changelog/#version-0-11-1)
  - [Version 0.11](changelog/#version-0-11)
  - [Version 0.10.1](changelog/#version-0-10-1)
  - [Version 0.10](changelog/#version-0-10)
  - [Version 0.9](changelog/#version-0-9)
  - [Version 0.8.1](changelog/#version-0-8-1)
  - [Version 0.8](changelog/#version-0-8)
  - [Version 0.7.2](changelog/#version-0-7-2)
  - [Version 0.7.1](changelog/#version-0-7-1)
  - [Version 0.7](changelog/#version-0-7)
  - [Version 0.6.1](changelog/#version-0-6-1)
  - [Version 0.6](changelog/#version-0-6)
  - [Version 0.5.2](changelog/#version-0-5-2)
  - [Version 0.5.1](changelog/#version-0-5-1)
  - [Version 0.5](changelog/#version-0-5)
  - [Version 0.4](changelog/#version-0-4)
  - [Version 0.3.1](changelog/#version-0-3-1)
  - [Version 0.3](changelog/#version-0-3)
  - [Version 0.2](changelog/#version-0-2)
  - [Version 0.1](changelog/#version-0-1)
- [License](license/)
  - [Source License](license/#source-license)
  - [Artwork License](license/#artwork-license)
- [How to contribute to Flask](contributing/)
  - [Support questions](contributing/#support-questions)
  - [Reporting issues](contributing/#reporting-issues)
  - [Submitting patches](contributing/#submitting-patches)
  - [Caution: zero-padded file modes](contributing/#caution-zero-padded-file-modes)

### Project Links

- [Donate to Pallets](https://palletsprojects.com/donate)
- [Flask Website](https://palletsprojects.com/p/flask/)
- [PyPI releases](https://pypi.org/project/Flask/)
- [Source Code](https://github.com/pallets/flask/)
- [Issue Tracker](https://github.com/pallets/flask/issues/)

### 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](http://sphinx-doc.org/) 2.2.2.