From 531671c9c5177f24e79a3062e2dc5d0aa60c29af Mon Sep 17 00:00:00 2001 From: Grey Li Date: Thu, 6 May 2021 09:27:35 +0800 Subject: [PATCH] Improve the wording of using FLASK_APP --- docs/cli.rst | 10 +++++----- docs/quickstart.rst | 12 +++++++++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/docs/cli.rst b/docs/cli.rst index b390c96e04..6036cb2d84 100644 --- a/docs/cli.rst +++ b/docs/cli.rst @@ -45,13 +45,13 @@ While ``FLASK_APP`` supports a variety of options for specifying your application, most use cases should be simple. Here are the typical values: (nothing) - The file :file:`wsgi.py` is imported, automatically detecting an app - (``app``). This provides an easy way to create an app from a factory with - extra arguments. + The name "app" or "wsgi" is imported (as a ".py" file, or package), + automatically detecting an app (``app`` or ``application``) or + factory (``create_app`` or ``make_app``). ``FLASK_APP=hello`` - The name is imported, automatically detecting an app (``app``) or factory - (``create_app``). + The given name is imported, automatically detecting an app (``app`` + or ``application``) or factory (``create_app`` or ``make_app``). ---- diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 0aca7ffdb5..9418835a58 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -50,7 +50,7 @@ to tell your terminal the application to work with by exporting the .. code-block:: text - $ export FLASK_APP=hello.py + $ export FLASK_APP=hello $ flask run * Running on http://127.0.0.1:5000/ @@ -58,7 +58,7 @@ to tell your terminal the application to work with by exporting the .. code-block:: text - > set FLASK_APP=hello.py + > set FLASK_APP=hello > flask run * Running on http://127.0.0.1:5000/ @@ -66,10 +66,16 @@ to tell your terminal the application to work with by exporting the .. code-block:: text - > $env:FLASK_APP = "hello.py" + > $env:FLASK_APP = "hello" > flask run * Running on http://127.0.0.1:5000/ +.. admonition:: Application Discovery Behavior + + As a shortcut, if the file is named ``app.py`` or ``wsgi.py``, you + don't have to set the ``FLASK_APP`` environment variable. See + :doc:`/cli` for more details. + This launches a very simple builtin server, which is good enough for testing but probably not what you want to use in production. For deployment options see :doc:`deploying/index`.