Browse files

Clarified language related to avoiding circular imports.

Signed-off-by: Armin Ronacher <>
  • Loading branch information...
1 parent 235369f commit 3deae1bd48bf7dfad863afae4d368993fc9bafe1 Drew Vogel committed with mitsuhiko Mar 9, 2011
Showing with 4 additions and 4 deletions.
  1. +4 −4 docs/patterns/packages.rst
@@ -56,8 +56,8 @@ following quick checklist:
`__name__` variable will resolve to the correct package.
2. all the view functions (the ones with a :meth:`~flask.Flask.route`
decorator on top) have to be imported when in the `` file.
- Not the object itself, but the module it is in. Do the importing at
- the *bottom* of the file.
+ Not the object itself, but the module it is in. Import the view module
+ *after the application object is created*.
Here's an example ``::
@@ -158,10 +158,10 @@ Do the same with the `` and then make sure to register the
modules in the application (``) like this::
from flask import Flask
+ app = Flask(__name__)
from yourapplication.views.admin import admin
from yourapplication.views.frontend import frontend
- app = Flask(__name__)
app.register_module(admin, url_prefix='/admin')

0 comments on commit 3deae1b

Please sign in to comment.