Skip to content
Myr

installation.rst

This file

Path

docs/installation.rst

144 lines · 3.7 KiB

Last changed by

Merge pull request #5072 from pallets/drop-py37David Lordbefore adoptionb4345cb

History of this file

Take it

The walk stopped after 200 commits: lines older than 93a7f08 point at it.

pin os and python version in rtd buildDavid Lordbefore adoption93a7f08

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

Merge pull request #5072 from pallets/drop-py37David Lordbefore adoptionb4345cb

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

pin os and python version in rtd buildDavid Lordbefore adoption93a7f08

lines 9–25why, 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.

Merge pull request #5058 from pallets/require-blinkerDavid Lordbefore adoptiona05c0c6

line 26why, one step back
26* `Blinker`_ provides support for :doc:`signals`.

pin os and python version in rtd buildDavid Lordbefore adoption93a7f08

lines 27–32why, one step back
27
28.. _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/

Merge pull request #5058 from pallets/require-blinkerDavid Lordbefore adoptiona05c0c6

line 33why, one step back
33.. _Blinker: https://blinker.readthedocs.io/

pin os and python version in rtd buildDavid Lordbefore adoption93a7f08

lines 34–86why, one step back
34
3536Optional 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~~~~~~~~5354You may choose to use gevent or eventlet with your application. In this55case, greenlet>=1.0 is required. When using PyPy, PyPy>=7.3.7 is56required.5758These are not minimum supported versions, they only indicate the first59versions that added necessary features. You should use the latest60versions of each.616263Virtual environments64--------------------6566Use a virtual environment to manage the dependencies for your project, both in67development and in production.6869What problem does a virtual environment solve? The more Python projects you70have, the more likely it is that you need to work with different versions of71Python libraries, or even Python itself. Newer versions of libraries for one72project can break compatibility in another project.7374Virtual environments are independent groups of Python libraries, one for each75project. Packages installed for one project will not affect other projects or76the operating system's packages.7778Python comes bundled with the :mod:`venv` module to create virtual79environments.808182.. _install-create-env:8384Create an environment85~~~~~~~~~~~~~~~~~~~~~86

Merge pull request #4947 from pallets/pyprojectDavid Lordbefore adoption78b42b9

line 87why, one step back
87Create a project folder and a :file:`.venv` folder within:

pin os and python version in rtd buildDavid Lordbefore adoption93a7f08

lines 88–96why, one step back
88
89.. tabs::9091 .. group-tab:: macOS/Linux9293 .. code-block:: text9495 $ mkdir myproject96 $ cd myproject

Merge pull request #4947 from pallets/pyprojectDavid Lordbefore adoption78b42b9

line 97why, one step back
97 $ python3 -m venv .venv

pin os and python version in rtd buildDavid Lordbefore adoption93a7f08

lines 98–104why, one step back
98
99 .. group-tab:: Windows100101 .. code-block:: text102103 > mkdir myproject104 > cd myproject

Merge pull request #4947 from pallets/pyprojectDavid Lordbefore adoption78b42b9

line 105why, one step back
105 > py -3 -m venv .venv

pin os and python version in rtd buildDavid Lordbefore adoption93a7f08

lines 106–120why, one step back
106
107108.. _install-activate-env:109110Activate the environment111~~~~~~~~~~~~~~~~~~~~~~~~112113Before you work on your project, activate the corresponding environment:114115.. tabs::116117 .. group-tab:: macOS/Linux118119 .. code-block:: text120

Merge pull request #4947 from pallets/pyprojectDavid Lordbefore adoption78b42b9

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

pin os and python version in rtd buildDavid Lordbefore adoption93a7f08

lines 122–126why, one step back
122
123 .. group-tab:: Windows124125 .. code-block:: text126

Merge pull request #4947 from pallets/pyprojectDavid Lordbefore adoption78b42b9

line 127why, one step back
127 > .venv\Scripts\activate

pin os and python version in rtd buildDavid Lordbefore adoption93a7f08

lines 128–144why, one step back
128
129Your shell prompt will change to show the name of the activated130environment.131132133Install Flask134-------------135136Within the activated environment, use the following command to install137Flask:138139.. code-block:: sh140141 $ pip install Flask142143Flask is now installed. Check out the :doc:`/quickstart` or go to the144:doc:`Documentation Overview </index>`.