title: How to import jinja2.ext.loopcontrols to Flask correctly?
body: <p>I have read in Flask documentation that I should import the "jinja2.ext.loopcontrols" extension in order to use the range tag.</p>
  
  <p>I'm trying to do so by:</p>
  
  <pre><code>app = Flask(__name__)
  app.jinja_env.add_extension('jinja2.ext.loopcontrols')
  app.config.from_object(__name__)
  </code></pre>
  
  <p>But every time I use the range tag, it gives me:</p>
  
  <pre><code>TemplateSyntaxError: Encountered unknown tag 'range'. Jinja was looking for the following tags: 'endblock'. The innermost block that needs to be closed is 'block'.
  </code></pre>
  
  <p>Here's my code in the template file:</p>
  
  <pre><code>{% range number from 1 to 5 %}
   {% for x in posts %}
    &lt;p&gt;The value of X is: &lt;/p&gt; {{ x }}
   {% endfor %}
  {% endrange %}
  </code></pre>
  
  <p>So what's the correct way to import it?</p>