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 fileTake 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 back1Installation2============345Python Version6--------------78We recommend using the latest version of Python. Flask supports PythonMerge pull request #4335 from pallets/drop-python-3.6David Lordbefore adoptionea93a52
line 9why, one step back93.7 and newer.parametrize some tests (#3786)Paul Sandersbefore adoption8c6baee
line 10why, one step back10Merge remote-tracking branch 'origin/2.0.x' into mainGrey Libefore adoptionba6db2e
line 11why, one step back11parametrize some tests (#3786)Paul Sandersbefore adoption8c6baee
lines 12–49why, one step back12Dependencies13------------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 back505152greenlet53~~~~~~~~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 back626364Virtual 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:89Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc
line 90why, one step back90.. tabs::parametrize some tests (#3786)Paul Sandersbefore adoption8c6baee
line 91why, one step back91Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc
line 92why, one step back92 .. group-tab:: macOS/Linuxparametrize some tests (#3786)Paul Sandersbefore adoption8c6baee
line 93why, one step back93Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc
line 94why, one step back94 .. code-block:: textparametrize some tests (#3786)Paul Sandersbefore adoption8c6baee
line 95why, one step back95Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc
lines 96–98why, one step back96 $ mkdir myproject97 $ cd myproject98 $ python3 -m venv venvparametrize some tests (#3786)Paul Sandersbefore adoption8c6baee
line 99why, one step back99Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc
line 100why, one step back100 .. group-tab:: Windowsparametrize some tests (#3786)Paul Sandersbefore adoption8c6baee
line 101why, one step back101Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc
line 102why, one step back102 .. code-block:: textparametrize some tests (#3786)Paul Sandersbefore adoption8c6baee
line 103why, one step back103Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc
lines 104–108why, one step back104 > mkdir myproject105 > cd myproject106 > py -3 -m venv venv107108parametrize some tests (#3786)Paul Sandersbefore adoption8c6baee
lines 109–115why, one step back109.. _install-activate-env:110111Activate the environment112~~~~~~~~~~~~~~~~~~~~~~~~113114Before you work on your project, activate the corresponding environment:115Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc
line 116why, one step back116.. tabs::parametrize some tests (#3786)Paul Sandersbefore adoption8c6baee
line 117why, one step back117Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc
line 118why, one step back118 .. group-tab:: macOS/Linuxparametrize some tests (#3786)Paul Sandersbefore adoption8c6baee
line 119why, one step back119Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc
line 120why, one step back120 .. code-block:: textparametrize some tests (#3786)Paul Sandersbefore adoption8c6baee
line 121why, one step back121Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc
line 122why, one step back122 $ . venv/bin/activateparametrize some tests (#3786)Paul Sandersbefore adoption8c6baee
line 123why, one step back123Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)Grey Libefore adoption1035efc
lines 124–128why, one step back124 .. group-tab:: Windows125126 .. code-block:: text127128 > venv\Scripts\activateparametrize some tests (#3786)Paul Sandersbefore adoption8c6baee
lines 129–145why, one step back129130Your 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>`.