Browse Source

Fixed a terrible wrong part in the module documentation

pull/184/head
Armin Ronacher 14 years ago
parent
commit
8ed051d5b5
  1. 17
      docs/patterns/packages.rst

17
docs/patterns/packages.rst

@ -248,22 +248,25 @@ If you want to refer to the templates you just have to prefix it with the
name of the module. So for the admin it would be
``render_template('admin/list_items.html')`` and so on. It is not
possible to refer to templates without the prefixed module name. This is
explicit unlike URL rules.
explicit unlike URL rules. Also with the move of the views into from
`yourapplication.views.admin` too `yourapplication.apps.admin.views` you
will have to give the module an explit shortname. Why? Because otherwise
all your modules will be internally known as `views` which is obviously
not what you want::
You also need to explicitly pass the ``url_prefix`` argument when
registering your modules this way::
# in yourapplication/apps/admin/views.py
admin = Module(__name__, 'admin')
The setup code changes slightly because of the imports::
# in yourapplication/__init__.py
from flask import Flask
from yourapplication.apps.admin.views import admin
from yourapplication.apps.frontend.views import frontend
app = Flask(__name__)
app.register_module(admin, url_prefix='/admin')
app.register_module(frontend, url_prefix='/frontend')
This is because Flask cannot infer the prefix from the package names.
app.register_module(frontend)
.. admonition:: References to Static Folders

Loading…
Cancel
Save