Skip to content
Myr

Updated documentation on packaging patterns

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by agentultra · committed by Armin Ronacher · parent 6e3dd9b · Browse files · 1 file+16 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+16 added−0 removed

  • other:+16 added−0 removed

1 file+16 added−0 removed

modified:docs/patterns/packages.rst+16 added
210 unmodified lines
211212 /yourapplication213 __init__.py214 /apps215 __init__.py216 /frontend217 __init__.py218 views.py219 /static
24 unmodified lines
244``render_template('admin/list_items.html')`` and so on. It is not245possible to refer to templates without the prefixed module name. This is246explicit unlike URL rules.247248You also need to explicitly pass the ``url_prefix`` argument when249registering your modules this way::250251 # in yourapplication/__init__.py252 from flask import Flask253 from yourapplication.apps.admin.views import admin254 from yourapplication.apps.frontend.views import frontend255256257 app = Flask(__name__)258 app.register_module(admin, url_prefix='/admin')259 app.register_module(frontend, url_prefix='/frontend')260261This is because Flask cannot infer the prefix from the package names.262263.. admonition:: References to Static Folders264265 Please keep in mind that if you are using unqualified endpoints by266 default Flask will always assume the module's static folder, even if
15 unmodified lines