Skip to content
Myr

Update docs/patterns/packages.rst

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

authored by Filip Ristić · committed by Filip Ristić · parent eac350d · Browse files · 1 file+1 added−1 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+1 added−1 removed

  • other:+1 added−1 removed

1 file+1 added−1 removed

modified:docs/patterns/packages.rst+1 added-1 removed
53 unmodified lines
541. the `Flask` application object creation has to be in the55 `__init__.py` file. That way each module can import it safely and the56 `__name__` variable will resolve to the correct package.572. all the view functions (the ones with a :meth:`~flask.Flask.route`58 decorator on top) have to be imported when in the `__init__.py` file.58 decorator on top) have to be imported in the `__init__.py` file.59 Not the object itself, but the module it is in. Import the view module60 **after the application object is created**.6162Here's an example `__init__.py`::
53 unmodified lines