flask-themes 出现TemplateNotFound问题

    今天学习flask-themes(https://bitbucket.org/leafstorm/flask-themes/src),运行源码中的example时发现模板不起作用,解决办法:https://bitbucket.org/leafstorm/flask-themes/pull-request/2/fix-to-make-jinjas-include-and-import/diff

flaskext/themes.py line:419

 @contextfunction
 def global_theme_template(ctx, templatename, fallback=True):
     theme = active_theme(ctx)
-    templatepath = '_themes/%s/%s' % (theme, templatename)
+    if USING_BLUEPRINTS:
+        templatepath = '%s/%s' % (theme, templatename)
+    else:
+        templatepath = '_themes/%s/%s' % (theme, templatename)
     if (not fallback) or template_exists(templatepath):
         return templatepath
     else:


你可能感兴趣的:(flask-themes)