1. how to add the option of FileSystemBytecodeCache to my flask app?
2. how to add the option of making jinja2 look in multiple directories for
templates?
this is how my app looks now
from flask import Flask, render_template,session,flash
app = Flask(__name__)
@app.route('/')
@app.route('/hello')
@app.route('/hello/<name>')
def hello_world(name=None):
return render_template('index.html', name=name)
if __name__ == '__main__':
app.run()
thanks!
Hi, On 8/13/11 5:55 PM, kevin wrote: > 1. how to add the option of FileSystemBytecodeCache to my flask app? Flask.jinja_options is a dictionary with options. Copy it and modify it before you access jinja_env or render templates. > 2. how to add the option of making jinja2 look in multiple directories > for templates? Customize the loader by overriding the hooks on Flask (see API docs) or append a new path to the created loader: app.jinja_loader.searchpath.append('/another/path') Also blueprints can provide additional folders for templates. Regards, Armin
thanks to mitsuhiko, from #pocoo On Sat, Aug 13, 2011 at 10:36 AM, Armin Ronacher < armin.ronacher@active-4.com> wrote: > Hi, > > On 8/13/11 5:55 PM, kevin wrote: > > 1. how to add the option of FileSystemBytecodeCache to my flask app? > Flask.jinja_options is a dictionary with options. Copy it and modify it > before you access jinja_env or render templates. > > app = Flask(__name__) app.jinja_options = app.jinja_options.copy() app.jinja_options['bytecode_cache'] = FileSystemBytecodeCache()