diff --git a/docs/patterns/packages.rst b/docs/patterns/packages.rst index 4ec09e6b..a6c7cce0 100644 --- a/docs/patterns/packages.rst +++ b/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