Skip to content
Myr

Fixed a terrible wrong part in the module documentation

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

authored by Armin Ronacher · committed by Armin Ronacher · parent 6562f2e · Browse files · 1 file+10 added−7 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+10 added−7 removed

  • other:+10 added−7 removed

1 file+10 added−7 removed

modified:docs/patterns/packages.rst+10 added-7 removed
246 unmodified lines
247If you want to refer to the templates you just have to prefix it with the248name of the module. So for the admin it would be249``render_template('admin/list_items.html')`` and so on. It is not250possible to refer to templates without the prefixed module name. This is251explicit unlike URL rules.251explicit unlike URL rules. Also with the move of the views into from252`yourapplication.views.admin` too `yourapplication.apps.admin.views` you253will have to give the module an explit shortname. Why? Because otherwise254all your modules will be internally known as `views` which is obviously255not what you want::256253You also need to explicitly pass the ``url_prefix`` argument when254registering your modules this way::257 # in yourapplication/apps/admin/views.py258 admin = Module(__name__, 'admin')259260The setup code changes slightly because of the imports::261262 # in yourapplication/__init__.py263 from flask import Flask264 from yourapplication.apps.admin.views import admin265 from yourapplication.apps.frontend.views import frontend266261267 app = Flask(__name__)268 app.register_module(admin, url_prefix='/admin')264 app.register_module(frontend, url_prefix='/frontend')269 app.register_module(frontend)270266This is because Flask cannot infer the prefix from the package names.267271.. admonition:: References to Static Folders272273 Please keep in mind that if you are using unqualified endpoints by274 default Flask will always assume the module's static folder, even if
15 unmodified lines