Skip to content
Myr

installation.rst

This file

Path

docs/installation.rst

145 lines · 3.7 KiB

Last changed by

Merge pull request #4335 from pallets/drop-python-3.6David Lordbefore adoptionea93a52

History of this file

Take it

The walk stopped after 200 commits: lines older than 8c6baee point at it.

parametrize some tests (#3786)Paul Sandersbefore adoption8c6baee

lines 1–8why, one step back
1Installation
2============345Python Version6--------------78We recommend using the latest version of Python. Flask supports Python

Merge pull request #4335 from pallets/drop-python-3.6David Lordbefore adoptionea93a52

line 9why, one step back
93.7 and newer.

parametrize some tests (#3786)Paul Sandersbefore adoption8c6baee

line 10why, one step back
10

Merge remote-tracking branch 'origin/2.0.x' into mainGrey Libefore adoptionba6db2e

line 11why, one step back
11

parametrize some tests (#3786)Paul Sandersbefore adoption8c6baee

lines 12–49why, one step back
12Dependencies
13------------1415These distributions will be installed automatically when installing Flask.1617* `Werkzeug`_ implements WSGI, the standard Python interface between18 applications and servers.19* `Jinja`_ is a template language that renders the pages your application20 serves.21* `MarkupSafe`_ comes with Jinja. It escapes untrusted input when rendering22 templates to avoid injection attacks.23* `ItsDangerous`_ securely signs data to ensure its integrity. This is used24 to protect Flask's session cookie.25* `Click`_ is a framework for writing command line applications. It provides26 the ``flask`` command and allows adding custom management commands.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/333435Optional dependencies36~~~~~~~~~~~~~~~~~~~~~3738These distributions will not be installed automatically. Flask will detect and39use them if you install them.4041* `Blinker`_ provides support for :doc:`signals`.42* `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.. _Blinker: https://pythonhosted.org/blinker/48.. _python-dotenv: https://github.com/theskumar/python-dotenv#readme49.. _watchdog: https://pythonhosted.org/watchdog/

Merge pull request #4335 from pallets/drop-python-3.6David Lordbefore adoptionea93a52

lines 50–61why, one step back
50
5152greenlet53~~~~~~~~5455You may choose to use gevent or eventlet with your application. In this56case, greenlet>=1.0 is required. When using PyPy, PyPy>=7.3.7 is57required.5859These are not minimum supported versions, they only indicate the first60versions that added necessary features. You should use the latest61versions of each.

parametrize some tests (#3786)Paul Sandersbefore adoption8c6baee

lines 62–89why, one step back
62
6364Virtual environments65--------------------6667Use a virtual environment to manage the dependencies for your project, both in68development and in production.6970What problem does a virtual environment solve? The more Python projects you71have, the more likely it is that you need to work with different versions of72Python libraries, or even Python itself. Newer versions of libraries for one73project can break compatibility in another project.7475Virtual environments are independent groups of Python libraries, one for each76project. Packages installed for one project will not affect other projects or77the operating system's packages.7879Python comes bundled with the :mod:`venv` module to create virtual80environments.818283.. _install-create-env:8485Create an environment86~~~~~~~~~~~~~~~~~~~~~8788Create a project folder and a :file:`venv` folder within:89

Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc

line 90why, one step back
90.. tabs::

parametrize some tests (#3786)Paul Sandersbefore adoption8c6baee

line 91why, one step back
91

Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc

line 92why, one step back
92 .. group-tab:: macOS/Linux

parametrize some tests (#3786)Paul Sandersbefore adoption8c6baee

line 93why, one step back
93

Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc

line 94why, one step back
94 .. code-block:: text

parametrize some tests (#3786)Paul Sandersbefore adoption8c6baee

line 95why, one step back
95

Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc

lines 96–98why, one step back
96 $ mkdir myproject
97 $ cd myproject98 $ python3 -m venv venv

parametrize some tests (#3786)Paul Sandersbefore adoption8c6baee

line 99why, one step back
99

Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc

line 100why, one step back
100 .. group-tab:: Windows

parametrize some tests (#3786)Paul Sandersbefore adoption8c6baee

line 101why, one step back
101

Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc

line 102why, one step back
102 .. code-block:: text

parametrize some tests (#3786)Paul Sandersbefore adoption8c6baee

line 103why, one step back
103

Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc

lines 104–108why, one step back
104 > mkdir myproject
105 > cd myproject106 > py -3 -m venv venv107108

parametrize some tests (#3786)Paul Sandersbefore adoption8c6baee

lines 109–115why, one step back
109.. _install-activate-env:
110111Activate the environment112~~~~~~~~~~~~~~~~~~~~~~~~113114Before you work on your project, activate the corresponding environment:115

Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc

line 116why, one step back
116.. tabs::

parametrize some tests (#3786)Paul Sandersbefore adoption8c6baee

line 117why, one step back
117

Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc

line 118why, one step back
118 .. group-tab:: macOS/Linux

parametrize some tests (#3786)Paul Sandersbefore adoption8c6baee

line 119why, one step back
119

Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc

line 120why, one step back
120 .. code-block:: text

parametrize some tests (#3786)Paul Sandersbefore adoption8c6baee

line 121why, one step back
121

Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc

line 122why, one step back
122 $ . venv/bin/activate

parametrize some tests (#3786)Paul Sandersbefore adoption8c6baee

line 123why, one step back
123

Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc

lines 124–128why, one step back
124 .. group-tab:: Windows
125126 .. code-block:: text127128 > venv\Scripts\activate

parametrize some tests (#3786)Paul Sandersbefore adoption8c6baee

lines 129–145why, one step back
129
130Your shell prompt will change to show the name of the activated131environment.132133134Install Flask135-------------136137Within the activated environment, use the following command to install138Flask:139140.. code-block:: sh141142 $ pip install Flask143144Flask is now installed. Check out the :doc:`/quickstart` or go to the145:doc:`Documentation Overview </index>`.