title: The method is not allowed for the requested URL. in Flask
body: <p>I write this forum and I want to validate user name and password but I have result.Method Not Allowed</p>
  
  <p>hello.html</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html lang='en'&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8" /&gt;
      &lt;title&gt;Hello&lt;/title&gt;
  
  &lt;/head&gt;
  {% if error %}
      {{ error }}
  {% endif %}
  &lt;body&gt;
  
        Hello 
  
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>The method is not allowed for the requested URL.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;!--[if (gte IE 9)|!(IE)]&gt;&lt;!--&gt; &lt;html lang="en"&gt; &lt;!--&lt;![endif]--&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;title&gt;welcome&lt;/title&gt;
  &lt;link href="{{ url_for('static', filename='style.css') }}" rel="stylesheet" type="text/css" /&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div class="container"&gt;
      &lt;section id="content"&gt;
          &lt;form action="/login" method="post"&gt;
              &lt;h1&gt;Login Form&lt;/h1&gt;
              &lt;div&gt;
                  &lt;input type="text" placeholder="Username" required=""  name="username" /&gt;
              &lt;/div&gt;
              &lt;div&gt;
                  &lt;input type="password" placeholder="Password" required="" name="password" /&gt;
              &lt;/div&gt;
              &lt;div&gt;
                  &lt;input type="submit" value="Log in"  /&gt;
  
              &lt;/div&gt;
          &lt;/form&gt;&lt;!-- form --&gt;
  
      &lt;/section&gt;&lt;!-- content --&gt;
  
  &lt;/div&gt;&lt;!-- container --&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  
  
  <p>I write a forum:</p>
  
  <p>in app.py:</p>
  
  <pre><code>from flask import Flask
  from flask import request
  from flask import render_template, redirect, url_for, request
  APP = Flask(__name__)
  @APP.route('/')
  def login1():
        return render_template('login1.html')
  @APP.route('/login', methods=['GET', 'POST'])
  def login():
      error = None
      if request.method == 'POST':
          if request.form['username'] != 'admin' or request.form['password'] != 'admin':
              error = 'Invalid Credentials. Please try again.'
          else:
              return redirect(url_for('home'))
     return render_template('hello.html', error=error)
  
  if __name__ == '__main__':
        APP.debug=True
        APP.run()
  </code></pre>
  
  <p>I can't validate the input?
  how can help me please</p>