title: werkzeug.routing.BuildError: Could not build url for endpoint 'success'. Did you forget to specify values ['name']?
body: <blockquote>
    <p>"werkzeug.routing.BuildError: Could not build url for endpoint 'success'. Did you forget to specify values ['name']?"</p>
  </blockquote>
  
  <p>How to solve this error? I have tried many things but can't solve it by myself.</p>
  
  <p>http_methods.py:</p>
  
  <pre><code>from flask import Flask, redirect, url_for, request
  app = Flask(__name__)
  
  @app.route('/success/&lt;name&gt;')
  def success(name):
      return 'welcome %s' % name
  
  @app.route('/login', methods=['POST', 'GET'])
  def login():
      if request.method == 'POST':
          user = request.form['nm']
          return redirect(url_for('success', name = user))
      else:
          user = request.args.get('nm')
          return redirect(url_for('success', name = user))
  
  if __name__ == "__main__":
      app.run(debug=True)
  </code></pre>
  
  <p>I get an error in the login method, that value of ['name'] is not specified; how to solve this error?</p>
  
  <p>login.html:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
      &lt;body&gt;
          &lt;form action="http://127.0.0.1:5000/login" method="POST"&gt;
              &lt;p&gt;Enter name:&lt;/p&gt;
              &lt;p&gt;&lt;input type="text" name="nm" value="nm"/&gt;&lt;/p&gt;
              &lt;p&gt;&lt;input type="submit" value="submit"/&gt;&lt;/p&gt;    
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>output:    </p>
  
  <pre><code>  File "/Users/chirag.kanzariya/pythonprojects/v_python/lib/python3.7/site-packages/flask/helpers.py", line 345, in url_for
      force_external=external)
    File "/Users/chirag.kanzariya/pythonprojects/v_python/lib/python3.7/site-packages/werkzeug/routing.py", line 1776, in build
      raise BuildError(endpoint, values, method, self)
  werkzeug.routing.BuildError: Could not build url for endpoint 'success'. Did you forget to specify values ['name']?
  127.0.0.1 - - [29/Jan/2019 14:48:00] "GET /login?__debugger__=yes&amp;cmd=resource&amp;f=style.css HTTP/1.1" 200 -
  127.0.0.1 - - [29/Jan/2019 14:48:00] "GET /login?__debugger__=yes&amp;cmd=resource&amp;f=jquery.js HTTP/1.1" 200 -
  127.0.0.1 - - [29/Jan/2019 14:48:00] "GET /login?__debugger__=yes&amp;cmd=resource&amp;f=debugger.js HTTP/1.1" 200 -
  127.0.0.1 - - [29/Jan/2019 14:48:00] "GET /login?__debugger__=yes&amp;cmd=resource&amp;f=ubuntu.ttf HTTP/1.1" 200 -
  127.0.0.1 - - [29/Jan/2019 14:48:00] "GET /login?__debugger__=yes&amp;cmd=resource&amp;f=console.png HTTP/1.1" 200 -
  127.0.0.1 - - [29/Jan/2019 14:48:00] "GET /login?__debugger__=yes&amp;cmd=resource&amp;f=console.png HTTP/1.1" 200 -
  </code></pre>
  
  <p>I am using python 3.7 and flask 1.0.2 version right now.</p>