Skip to content
Myr

installation.rst

This file

Path

docs/installation.rst

143 lines · 3.7 KiB

Last changed by

drop support for Python 3.10 (#6168)David Lordbefore adoption728c5e4

History of this file

Take it

The walk stopped after 200 commits: lines older than 73739a2 point at it.

Merge branch '2.2.x'David Lordbefore adoption73739a2

lines 1–7why, one step back
1Installation
2============345Python Version6--------------7

drop support for Python 3.10 (#6168)David Lordbefore adoption728c5e4

line 8why, one step back
8We recommend using the latest version of Python. Flask supports Python 3.11 and newer.

Merge branch '2.2.x'David Lordbefore adoption73739a2

lines 9–53why, one step back
9
1011Dependencies12------------1314These distributions will be installed automatically when installing Flask.1516* `Werkzeug`_ implements WSGI, the standard Python interface between17 applications and servers.18* `Jinja`_ is a template language that renders the pages your application19 serves.20* `MarkupSafe`_ comes with Jinja. It escapes untrusted input when rendering21 templates to avoid injection attacks.22* `ItsDangerous`_ securely signs data to ensure its integrity. This is used23 to protect Flask's session cookie.24* `Click`_ is a framework for writing command line applications. It provides25 the ``flask`` command and allows adding custom management commands.26* `Blinker`_ provides support for :doc:`signals`.2728.. _Werkzeug: https://palletsprojects.com/p/werkzeug/29.. _Jinja: https://palletsprojects.com/p/jinja/30.. _MarkupSafe: https://palletsprojects.com/p/markupsafe/31.. _ItsDangerous: https://palletsprojects.com/p/itsdangerous/32.. _Click: https://palletsprojects.com/p/click/33.. _Blinker: https://blinker.readthedocs.io/343536Optional dependencies37~~~~~~~~~~~~~~~~~~~~~3839These distributions will not be installed automatically. Flask will detect and40use them if you install them.4142* `python-dotenv`_ enables support for :ref:`dotenv` when running ``flask``43 commands.44* `Watchdog`_ provides a faster, more efficient reloader for the development45 server.4647.. _python-dotenv: https://github.com/theskumar/python-dotenv#readme48.. _watchdog: https://pythonhosted.org/watchdog/495051greenlet52~~~~~~~~53

Merge branch 'stable'David Lordbefore adoption798e006

lines 54–55why, one step back
54You may choose to use :doc:`/gevent` with your application. In this case,
55greenlet>=1.0 is required. When using PyPy, PyPy>=7.3.7 is required.

Merge branch '2.2.x'David Lordbefore adoption73739a2

lines 56–143why, one step back
56
57These are not minimum supported versions, they only indicate the first58versions that added necessary features. You should use the latest59versions of each.606162Virtual environments63--------------------6465Use a virtual environment to manage the dependencies for your project, both in66development and in production.6768What problem does a virtual environment solve? The more Python projects you69have, the more likely it is that you need to work with different versions of70Python libraries, or even Python itself. Newer versions of libraries for one71project can break compatibility in another project.7273Virtual environments are independent groups of Python libraries, one for each74project. Packages installed for one project will not affect other projects or75the operating system's packages.7677Python comes bundled with the :mod:`venv` module to create virtual78environments.798081.. _install-create-env:8283Create an environment84~~~~~~~~~~~~~~~~~~~~~8586Create a project folder and a :file:`.venv` folder within:8788.. tabs::8990 .. group-tab:: macOS/Linux9192 .. code-block:: text9394 $ mkdir myproject95 $ cd myproject96 $ python3 -m venv .venv9798 .. group-tab:: Windows99100 .. code-block:: text101102 > mkdir myproject103 > cd myproject104 > py -3 -m venv .venv105106107.. _install-activate-env:108109Activate the environment110~~~~~~~~~~~~~~~~~~~~~~~~111112Before you work on your project, activate the corresponding environment:113114.. tabs::115116 .. group-tab:: macOS/Linux117118 .. code-block:: text119120 $ . .venv/bin/activate121122 .. group-tab:: Windows123124 .. code-block:: text125126 > .venv\Scripts\activate127128Your shell prompt will change to show the name of the activated129environment.130131132Install Flask133-------------134135Within the activated environment, use the following command to install136Flask:137138.. code-block:: sh139140 $ pip install Flask141142Flask is now installed. Check out the :doc:`/quickstart` or go to the143:doc:`Documentation Overview </index>`.