title: How do I fix an endpoint error with flask blueprints
body: <p>I am learning flask with blueprints and I have the following code example:</p>
  
  <pre><code>from flask import Flask, render_template, Blueprint, g
  
  bp = Blueprint('language', __name__, url_prefix='/&lt;int:language_id&gt;', static_folder='static')
  app = Flask(__name__)
  
  
  @bp.url_defaults
  def add_language_id(endpoint, values):
      if 'language_id' in g:
          values.setdefault('language_id', g.site_id)
      else:
          g.language_id = 1  # English
  
  
  @bp.url_value_preprocessor
  def pull_language_id(endpoint, values):
      g.language_id = values.pop('language_id')
  
  
  @bp.route('/')
  def index():
      return render_template('main.html')
  
  
  @bp.route('/lang')
  def language():
      return render_template('lang.html')
  
  app.register_blueprint(bp)
  
  if __name__ == '__main__':
      app.run()
  </code></pre>
  
  <p>But I'm getting this error:</p>
  
  <blockquote>
    <p>werkzeug.routing.BuildError: Could not build url for endpoint
    'language' with values ['language_id']. Did you mean 'language.index'
    instead?</p>
  </blockquote>
  
  <p>Here is the HTML code:</p>
  
  <pre><code>&lt;ul&gt;
      &lt;li&gt;
          &lt;a href="{{ url_for('language', language_id=1) }}"&gt;English&lt;/a&gt;
      &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>How do I correct this error?</p>