Updated documentation on packaging patterns

This commit is contained in:
agentultra 2010-09-10 03:33:20 +08:00 committed by Armin Ronacher
parent 6e3dd9b3ce
commit c62422c318

View file

@ -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