title: How can I send variables to Jinja template from a Flask decorator?
body: <p>Many routes around my blueprinted flask app will need to send 'sidebar data' to jinja.</p>
  
  <p>I'm looking for the most efficient way to do this. Their has to be something better than importing my 'generate_sidebar_data()' function into every blueprint, repeatedly saying:</p>
  
  <pre><code>var1, var2, var3 = generate_sidebar_data()
  </code></pre>
  
  <p>and then sending them with 'render_template':</p>
  
  <pre><code>return render_template('template.html',
                             var1=var1,
                             var2=var2,
                             var3=var3
                        )
  </code></pre>
  
  <p>What I want is a decorator that I can put with the route that will do the same thing the above does (run function and send the vars to jinja) but I don't know if this is possible. How do you send variables to jinja from inside a decorator function?</p>
  
  <pre><code>@blueprint.route('/')
  @include_sidebar_data
  def frontpage():
  
      return render_template('template.html')
  </code></pre>