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

* Enable Sphinx extension sphinx-tabs

* Add command tabs for all export commands

* Add command tabs for all venv commands

Fix trim spaces
This commit is contained in:
Grey Li 2020-10-16 05:08:37 +08:00 committed by GitHub
parent c5a5d9b30b
commit 1035efc7d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 498 additions and 126 deletions

View file

@ -44,20 +44,31 @@ To run the application, use the :command:`flask` command or
to tell your terminal the application to work with by exporting the
``FLASK_APP`` environment variable:
.. code-block:: text
.. tabs::
$ export FLASK_APP=hello.py
$ flask run
* Running on http://127.0.0.1:5000/
.. group-tab:: Bash
If you are on Windows, the environment variable syntax depends on command line
interpreter. On Command Prompt::
.. code-block:: text
C:\path\to\app>set FLASK_APP=hello.py
$ export FLASK_APP=hello.py
$ flask run
* Running on http://127.0.0.1:5000/
And on PowerShell::
.. group-tab:: CMD
PS C:\path\to\app> $env:FLASK_APP = "hello.py"
.. code-block:: text
> set FLASK_APP=hello.py
> flask run
* Running on http://127.0.0.1:5000/
.. group-tab:: Powershell
.. code-block:: text
> $env:FLASK_APP = "hello.py"
> flask run
* Running on http://127.0.0.1:5000/
This launches a very simple builtin server, which is good enough for
testing but probably not what you want to use in production. For
@ -135,10 +146,28 @@ error occurs during a request.
To enable all development features, set the ``FLASK_ENV`` environment
variable to ``development`` before calling ``flask run``.
.. code-block:: text
.. tabs::
$ export FLASK_ENV=development
$ flask run
.. group-tab:: Bash
.. code-block:: text
$ export FLASK_ENV=development
$ flask run
.. group-tab:: CMD
.. code-block:: text
> set FLASK_ENV=development
> flask run
.. group-tab:: Powershell
.. code-block:: text
> $env:FLASK_ENV = "development"
> flask run
See also: