def register_template_dirs(self):
"""
Go Through all sub applications under (crm) and if a dir called (templates)
found, register it as a template directory
"""
template_dirs = []
for root, dirs, _ in os.walk('crm'):
for dir in dirs:
if not dir == 'templates':
continue
template_dirs.append(os.path.abspath(os.path.join(root, dir)))
template_loader = jinja2.ChoiceLoader([
self._app.jinja_loader,
jinja2.FileSystemLoader(template_dirs),
]
)
self._app.jinja_loader = template_loader
评论列表
文章目录