Skip to content

Instantly share code, notes, and snippets.

@mrjoes
Last active September 9, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrjoes/d1d9586c3d789aa0f9e9 to your computer and use it in GitHub Desktop.
Save mrjoes/d1d9586c3d789aa0f9e9 to your computer and use it in GitHub Desktop.
import os.path as op
from flask import Flask
from flask.helpers import locked_cached_property
from jinja2 import FileSystemLoader
class BubbleApp(Flask):
def __init__(self):
super(BubbleApp, self).__init__(__name__)
# Custom template loader with support for plugins
@locked_cached_property
def jinja_loader(self):
paths = []
plugin_path = op.join(op.dirname(op.abspath(__file__)), 'customizations', 'templates')
if op.exists(plugin_path):
paths.append(plugin_path)
paths.append(op.join(self.root_path, self.template_folder))
return FileSystemLoader(paths)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment