document wsgi.py and app.py default modules

This commit is contained in:
Miguel Grinberg 2017-06-15 12:15:38 -07:00
parent 7c40aa9e50
commit 0b80acb25c
No known key found for this signature in database
GPG Key ID: 36848B262DF5F06C
1 changed files with 7 additions and 3 deletions

View File

@ -26,9 +26,13 @@ built-in commands that are always there. Flask extensions can also
register more commands there if they desire so.
For the :command:`flask` script to work, an application needs to be
discovered. This is achieved by exporting the ``FLASK_APP`` environment
variable. It can be either set to an import path or to a filename of a
Python module that contains a Flask application.
discovered. Flask looks for a module named wsgi.py or app.py by default, and
if it finds one it assumes the application is defined in it.
You can instruct Flask to look for the application in a different module by
exporting the ``FLASK_APP`` environment variable. It can be either set to an
import path or to a filename of a Python module that contains a Flask
application.
In that imported file the name of the app needs to be called ``app`` or
optionally be specified after a colon. For instance