From c62422c3181f2f8332893b06ee83581d63bceac8 Mon Sep 17 00:00:00 2001 From: agentultra Date: Fri, 10 Sep 2010 03:33:20 +0800 Subject: [PATCH] Updated documentation on packaging patterns --- docs/patterns/packages.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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