def get_context():
    context = {'var1': 'value 1', 'var2': 'value 2', 'var3': 'value 3'}
return context

@pgt.route('/myview')
def myview():
    return render_template('mytemplate.html', **get_context())
How to test template context variables with Flask