title: Flask context variable not available in template
body: <p>New to Flask and trying to work on a tutorial but running into some problems with the context variable from <code>render_template()</code> method.</p>
  
  <p>Here is <code>app.py</code>:</p>
  
  <pre><code>from flask import Flask, render_template, url_for
  app = Flask(__name__)
  
  posts = [
      {
          'author': 'Some Author',
          'title': 'Blog Post 1',
          'content': 'First blog post',
          'date_posted': 'April 21, 2018'
      },
      {
          'author': 'Another Author',
          'title': 'Blog Post 2',
          'content': 'Second blog post',
          'date_posted': 'May 21, 2013'
      }
  ]
  
  
  @app.route("/")
  @app.route("/home")
  def home():
      return render_template('home.html', posts=posts)
  
  
  @app.route("/about")
  def about():
      return render_template('about.html')
  
  
  if __name__ == '__main__':
      app.run(debug=True)
  </code></pre>
  
  <p>And this is my <code>home.html</code> template:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Home&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      { % for post in posts % }
          &lt;h4&gt;{{ post.title }}&lt;/h4&gt;
          &lt;p&gt;By {{ post.author }} on {{ post.date_posted }}&lt;/p&gt;
          &lt;p&gt;{{ post.content }}&lt;/p&gt;
      { % endfor % }
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>But the above isn't working.
  In browser at top of the page I get,</p>
  
  <pre><code>jinja2.exceptions.UndefinedError
  jinja2.exceptions.UndefinedError: 'post' is undefined
  </code></pre>
  
  <p>Here is the traceback from the terminal as well:</p>
  
  <pre><code>File "/home/bigdaddy/Sites/Flask_Blog/lib/python3.6/site-packages/flask/app.py", line 2309, in __call__
      return self.wsgi_app(environ, start_response)
    File "/home/bigdaddy/Sites/Flask_Blog/lib/python3.6/site-packages/flask/app.py", line 2295, in wsgi_app
      response = self.handle_exception(e)
    File "/home/bigdaddy/Sites/Flask_Blog/lib/python3.6/site-packages/flask/app.py", line 1741, in handle_exception
      reraise(exc_type, exc_value, tb)
    File "/home/bigdaddy/Sites/Flask_Blog/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
      raise value
    File "/home/bigdaddy/Sites/Flask_Blog/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app
      response = self.full_dispatch_request()
    File "/home/bigdaddy/Sites/Flask_Blog/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request
      rv = self.handle_user_exception(e)
    File "/home/bigdaddy/Sites/Flask_Blog/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception
      reraise(exc_type, exc_value, tb)
    File "/home/bigdaddy/Sites/Flask_Blog/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
      raise value
    File "/home/bigdaddy/Sites/Flask_Blog/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
      rv = self.dispatch_request()
    File "/home/bigdaddy/Sites/Flask_Blog/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
      return self.view_functions[rule.endpoint](**req.view_args)
    File "/home/bigdaddy/Sites/Flask_Blog/app.py", line 25, in home
      return render_template('home.html', some_list=posts)
    File "/home/bigdaddy/Sites/Flask_Blog/lib/python3.6/site-packages/flask/templating.py", line 135, in render_template
      context, ctx.app)
    File "/home/bigdaddy/Sites/Flask_Blog/lib/python3.6/site-packages/flask/templating.py", line 117, in _render
      rv = template.render(context)
    File "/home/bigdaddy/Sites/Flask_Blog/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 76, in render
      return original_render(self, *args, **kwargs)
    File "/home/bigdaddy/Sites/Flask_Blog/lib/python3.6/site-packages/jinja2/environment.py", line 1008, in render
      return self.environment.handle_exception(exc_info, True)
    File "/home/bigdaddy/Sites/Flask_Blog/lib/python3.6/site-packages/jinja2/environment.py", line 780, in handle_exception
      reraise(exc_type, exc_value, tb)
    File "/home/bigdaddy/Sites/Flask_Blog/lib/python3.6/site-packages/jinja2/_compat.py", line 37, in reraise
      raise value.with_traceback(tb)
    File "/home/bigdaddy/Sites/Flask_Blog/templates/home.html", line 8, in top-level template code
      &lt;h4&gt;{{ post.title }}&lt;/h4&gt;
    File "/home/bigdaddy/Sites/Flask_Blog/lib/python3.6/site-packages/jinja2/environment.py", line 430, in getattr
      return getattr(obj, attribute)
  jinja2.exceptions.UndefinedError: 'post' is undefined
  </code></pre>
  
  <p>Any help would be greatly appreciated.
  Using python3.6 in a virtualenv on Xubuntu Linux 16.04 if that helps.
  Thanks</p>