Skip to content
Myr

Merge pull request #2500 from BogdanAlexandru/patch-1

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

Improvements in the final sections of appfactories.rst

authored by David Lord · committed by GitHub · parents a35fc3c, b89cf95 · Browse files · 1 file+10 added−11 removed
This commit

State

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

Diff stats

1 file+10 added−11 removed

  • other:+10 added−11 removed

1 file+10 added−11 removed

modified:docs/patterns/appfactories.rst+10 added-11 removed
87 unmodified lines
8889Using Applications90------------------9192So to use such an application you then have to create the application93first in a separate file otherwise the :command:`flask` command won't be able94to find it. Here an example :file:`exampleapp.py` file that creates such95an application::92To 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::9596 from yourapplication import create_app97 app = create_app('/path/to/config.cfg')98
4 unmodified lines
103104Factory Improvements105--------------------106108The factory function from above is not very clever so far, you can improve109it. The following changes are straightforward and possible:107The factory function above is not very clever, but you can improve it.108The following changes are straightforward to implement:1091111. make it possible to pass in configuration values for unittests so that112 you don't have to create config files on the filesystem1132. call a function from a blueprint when the application is setting up so1101. Make it possible to pass in configuration values for unit tests so that111 you don't have to create config files on the filesystem.1122. Call a function from a blueprint when the application is setting up so113 that you have a place to modify attributes of the application (like115 hooking in before / after request handlers etc.)1163. Add in WSGI middlewares when the application is creating if necessary.114 hooking in before/after request handlers etc.)1153. Add in WSGI middlewares when the application is being created if necessary.