在这一刻,我有一个应用程序,有超过100个模板文件如下:
-app/
--templates/
---template1.html
---template2.html
--- ...
---template100.html
但我想在一些文件夹中分离这些文件,例如:
-app/
--templates/
---masters/
----master1.html
----master2.html
---components/
----component1.html
----component2.html
---others/
----other1.html
----other2.html
问题:是否有方法从模板文件夹中的文件夹加载模板,或者所有模板都必须位于模板文件夹中?你知道吗
是的,这是可能的,你唯一要确定的是你的设置.py还有你的观点。你知道吗
设置.py:
只需链接到
folder/*.html
,如上的下面示例视图.py:相关问题 更多 >
编程相关推荐