Merge branch '2.0.x'

This commit is contained in:
David Lord 2022-02-09 07:37:43 -08:00
commit e37e87140e
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
23 changed files with 221 additions and 180 deletions

View file

@ -27,6 +27,13 @@ environment variable is used to specify how to load the application.
$ export FLASK_APP=hello
$ flask run
.. group-tab:: Fish
.. code-block:: text
$ set -x FLASK_APP hello
$ flask run
.. group-tab:: CMD
.. code-block:: text
@ -156,6 +163,20 @@ reloader.
* Debugger is active!
* Debugger PIN: 223-456-919
.. group-tab:: Fish
.. code-block:: text
$ set -x FLASK_ENV development
$ flask run
* Serving Flask app "hello"
* Environment: development
* Debug mode: on
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with inotify reloader
* Debugger is active!
* Debugger PIN: 223-456-919
.. group-tab:: CMD
.. code-block:: text
@ -207,6 +228,17 @@ separated with ``:``, or ``;`` on Windows.
* Running on http://127.0.0.1:8000/
* Detected change in '/path/to/file1', reloading
.. group-tab:: Fish
.. code-block:: text
$ flask run --extra-files file1:dirA/file2:dirB/
# or
$ set -x FLASK_RUN_EXTRA_FILES file1 dirA/file2 dirB/
$ flask run
* Running on http://127.0.0.1:8000/
* Detected change in '/path/to/file1', reloading
.. group-tab:: CMD
.. code-block:: text
@ -287,6 +319,14 @@ command, instead of ``flask run --port 8000``:
$ flask run
* Running on http://127.0.0.1:8000/
.. group-tab:: Fish
.. code-block:: text
$ set -x FLASK_RUN_PORT 8000
$ flask run
* Running on http://127.0.0.1:8000/
.. group-tab:: CMD
.. code-block:: text
@ -334,6 +374,13 @@ configure as expected.
$ export FLASK_SKIP_DOTENV=1
$ flask run
.. group-tab:: Fish
.. code-block:: text
$ set -x FLASK_SKIP_DOTENV 1
$ flask run
.. group-tab:: CMD
.. code-block:: text
@ -364,6 +411,12 @@ script. Activating the virtualenv will set the variables.
$ export FLASK_APP=hello
.. group-tab:: Fish
Fish, :file:`venv/bin/activate.fish`::
$ set -x FLASK_APP hello
.. group-tab:: CMD
Windows CMD, :file:`venv\\Scripts\\activate.bat`::

View file

@ -76,6 +76,13 @@ set :envvar:`FLASK_ENV`:
$ export FLASK_ENV=development
$ flask run
.. group-tab:: Fish
.. code-block:: text
$ set -x FLASK_ENV development
$ flask run
.. group-tab:: CMD
.. code-block:: text
@ -445,6 +452,14 @@ in the shell before starting the server:
$ flask run
* Running on http://127.0.0.1:5000/
.. group-tab:: Fish
.. code-block:: text
$ set -x YOURAPPLICATION_SETTINGS /path/to/settings.cfg
$ flask run
* Running on http://127.0.0.1:5000/
.. group-tab:: CMD
.. code-block:: text
@ -517,6 +532,15 @@ Environment variables can be set in the shell before starting the server:
$ flask run
* Running on http://127.0.0.1:5000/
.. group-tab:: Fish
.. code-block:: text
$ set -x SECRET_KEY "5f352379324c22463451387a0aec5d2f"
$ set -x MAIL_ENABLED false
$ flask run
* Running on http://127.0.0.1:5000/
.. group-tab:: CMD
.. code-block:: text

View file

@ -53,6 +53,13 @@ enables the debugger and reloader.
$ export FLASK_ENV=development
$ flask run
.. group-tab:: Fish
.. code-block:: text
$ set -x FLASK_ENV development
$ flask run
.. group-tab:: CMD
.. code-block:: text
@ -106,6 +113,13 @@ When running from the command line:
$ export FLASK_ENV=development
$ flask run --no-debugger --no-reload
.. group-tab:: Fish
.. code-block:: text
$ set -x FLASK_ENV development
$ flask run --no-debugger --no-reload
.. group-tab:: CMD
.. code-block:: text

View file

@ -98,6 +98,13 @@ To run such an application, you can use the :command:`flask` command:
$ export FLASK_APP=myapp
$ flask run
.. group-tab:: Fish
.. code-block:: text
$ set -x FLASK_APP myapp
$ flask run
.. group-tab:: CMD
.. code-block:: text
@ -124,6 +131,13 @@ in ``myapp``. You can also pass arguments to the factory like this:
$ export FLASK_APP="myapp:create_app('dev')"
$ flask run
.. group-tab:: Fish
.. code-block:: text
$ set -x FLASK_APP "myapp:create_app('dev')"
$ flask run
.. group-tab:: CMD
.. code-block:: text

View file

@ -67,6 +67,12 @@ that tells Flask where to find the application instance:
$ export FLASK_APP=yourapplication
.. group-tab:: Fish
.. code-block:: text
$ set -x FLASK_APP yourapplication
.. group-tab:: CMD
.. code-block:: text
@ -91,6 +97,12 @@ development features like this:
$ export FLASK_ENV=development
.. group-tab:: Fish
.. code-block:: text
$ set -x FLASK_ENV development
.. group-tab:: CMD
.. code-block:: text

View file

@ -54,6 +54,14 @@ to tell your terminal the application to work with by exporting the
$ flask run
* Running on http://127.0.0.1:5000/
.. group-tab:: Fish
.. code-block:: text
$ set -x FLASK_APP hello
$ flask run
* Running on http://127.0.0.1:5000/
.. group-tab:: CMD
.. code-block:: text
@ -166,6 +174,13 @@ variable to ``development`` before calling ``flask run``.
$ export FLASK_ENV=development
$ flask run
.. group-tab:: Fish
.. code-block:: text
$ set -x FLASK_ENV development
$ flask run
.. group-tab:: CMD
.. code-block:: text

View file

@ -173,18 +173,6 @@ invisibly to clicks on your page's elements. This is also known as
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
X-XSS-Protection
~~~~~~~~~~~~~~~~
The browser will try to prevent reflected XSS attacks by not loading the page
if the request contains something that looks like JavaScript and the response
contains the same data. ::
response.headers['X-XSS-Protection'] = '1; mode=block'
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection
.. _security-cookie:
Set-Cookie options

View file

@ -33,6 +33,14 @@ fully enable development mode.
$ export FLASK_ENV=development
$ flask run
.. group-tab:: Fish
.. code-block:: text
$ set -x FLASK_APP hello
$ export FLASK_ENV=development
$ flask run
.. group-tab:: CMD
.. code-block:: text

View file

@ -57,6 +57,13 @@ create the database in the instance folder.
$ export FLASK_APP=flaskr
$ flask init-db
.. group-tab:: Fish
.. code-block:: text
$ set -x FLASK_APP flaskr
$ flask init-db
.. group-tab:: CMD
.. code-block:: text

View file

@ -145,6 +145,14 @@ follow the tutorial.
$ export FLASK_ENV=development
$ flask run
.. group-tab:: Fish
.. code-block:: text
$ set -x FLASK_APP flaskr
$ set -x FLASK_ENV development
$ flask run
.. group-tab:: CMD
.. code-block:: text