diff --git a/docs/patterns/packages.rst b/docs/patterns/packages.rst index cd2deac1..35033b59 100644 --- a/docs/patterns/packages.rst +++ b/docs/patterns/packages.rst @@ -212,6 +212,7 @@ static files and templates. Imagine you have an application like this:: /yourapplication __init__.py /apps + __init__.py /frontend __init__.py views.py @@ -244,6 +245,21 @@ name of the module. So for the admin it would be possible to refer to templates without the prefixed module name. This is explicit unlike URL rules. +You also need to explicitly pass the ``url_prefix`` argument when +registering your modules this way:: + + # 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. + .. admonition:: References to Static Folders Please keep in mind that if you are using unqualified endpoints by