Skip to content
Myr

Merge pull request #2565 from greyli/patch-6

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by GitHub · parents 2bec58f, 94fd3ed · Browse files · 1 file+10 added−8 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Docs: Update CLI for factory pattern

Diff stats

1 file+10 added−8 removed

  • other:+10 added−8 removed

1 file+10 added−8 removed

modified:docs/patterns/appfactories.rst+10 added-8 removed
87 unmodified lines
8889Using Applications90------------------9192To use such an application you have to create it in a separate file first,93otherwise the :command:`flask` command won't be able to find it. Here's an94example :file:`exampleapp.py` file that creates such an application::92To run such an application, you can use the :command:`flask` command::9396 from yourapplication import create_app97 app = create_app('/path/to/config.cfg')94 export FLASK_APP=myapp95 flask run96 97Flask will automatically detect the factory (``create_app`` or ``make_app``) 98in ``myapp``. You can also pass arguments to the factory like this::9999It can then be used with the :command:`flask` command::100101 export FLASK_APP=exampleapp100 export FLASK_APP="myapp:create_app('dev')"101 flask run102 103Then the ``create_app`` factory in ``myapp`` is called with the string104``'dev'`` as the argument. See :doc:`/cli` for more detail.105106Factory Improvements107--------------------108
9 unmodified lines