File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -212,6 +212,7 @@ static files and templates. Imagine you have an application like this::
212
212
/yourapplication
213
213
__init__.py
214
214
/apps
215
+ __init__.py
215
216
/frontend
216
217
__init__.py
217
218
views.py
@@ -244,6 +245,21 @@ name of the module. So for the admin it would be
244
245
possible to refer to templates without the prefixed module name. This is
245
246
explicit unlike URL rules.
246
247
248
+ You also need to explicitly pass the ``url_prefix `` argument when
249
+ registering your modules this way::
250
+
251
+ # in yourapplication/__init__.py
252
+ from flask import Flask
253
+ from yourapplication.apps.admin.views import admin
254
+ from yourapplication.apps.frontend.views import frontend
255
+
256
+
257
+ app = Flask(__name__)
258
+ app.register_module(admin, url_prefix='/admin')
259
+ app.register_module(frontend, url_prefix='/frontend')
260
+
261
+ This is because Flask cannot infer the prefix from the package names.
262
+
247
263
.. admonition :: References to Static Folders
248
264
249
265
Please keep in mind that if you are using unqualified endpoints by
You can’t perform that action at this time.
0 commit comments