title: GETTING POST REQUEST ERROR 405 in FLASK WEBFRAMEWORK
body: <p>I have looked answers of the questions that were asked related to this but even then my problem stays there.
  Basically I am making login page in flask. Record is present in my database Also I have used method = POST in html, app but even then I am getting this error
  Output:
  <a href="https://i.stack.imgur.com/ueo36.png" rel="nofollow noreferrer">output</a></p>
  <p>HTML:</p>
  <pre><code>&lt;form method=&quot;POST&quot;&gt;
  &lt;div class=&quot;row&quot;&gt;
    &lt;h2 style=&quot;text-align:center; font-family:Courier New; color:#468E85&quot; &gt; Welcome this will be amazing experience:) &lt;/h2&gt;
    &lt;div class=&quot;vl&quot;&gt;
      &lt;span class=&quot;vl-innertext&quot;&gt;or&lt;/span&gt;
    &lt;/div&gt;
  
    &lt;div class=&quot;col&quot;&gt;
      &lt;a href=&quot;https://web.facebook.com/&quot; class=&quot;fb btn&quot;&gt;
        &lt;i class=&quot;fa fa-facebook fa-fw&quot;&gt;&lt;/i&gt; Login with Facebook
       &lt;/a&gt;
      &lt;a href=&quot;https://twittermobile..com/login&quot; class=&quot;twitter btn&quot;&gt;
        &lt;i class=&quot;fa fa-twitter fa-fw&quot;&gt;&lt;/i&gt; Login with Twitter
      &lt;/a&gt;
      &lt;a href=&quot;https://myaccount.google.com/&quot; class=&quot;google btn&quot;&gt;&lt;i class=&quot;fa fa-google fa-fw&quot;&gt;
        &lt;/i&gt; Login with Google+
      &lt;/a&gt;
    &lt;/div&gt;
  
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;hide-md-lg&quot;&gt;
        
      &lt;/div&gt;
    &lt;label for=&quot;username&quot;&gt;Username&lt;/label&gt;
      &lt;input type=&quot;&quot; id=&quot;username&quot; name=&quot;username&quot; placeholder=&quot;Username&quot; value=&quot;{{
        request.form.username }}&quot; required&gt;
     &lt;label for=&quot;psw&quot;&gt;Password&lt;/label&gt;
  </code></pre>
  <p>&lt;input type=&quot;password&quot; id=&quot;psw&quot; name=&quot;psw&quot; pattern=&quot;(?=.<em>\d)(?=.</em>[a-z])(?=.*[A-Z]).{8,}&quot; title=&quot;Must contain at least one number and one uppercase and lowercase letter, and at least 8 or more characters&quot; value=&quot;{{
  request.form.password }}&quot;required&gt;</p>
  <pre><code>&lt;button type=&quot;submit&quot; class=&quot;btn form-control btn-default&quot;&gt;Login&lt;/button&gt;
      &lt;button type=&quot;button&quot; class=&quot;btn btn-primary&quot;&gt;Sign Up&lt;/button&gt;
      &lt;div class=&quot;msg&quot;&gt;{{ msg }}&lt;/div&gt;
  
    &lt;button class=&quot;submit&quot; style=&quot;color: #008080&quot;&gt;Forgot password?&lt;/button&gt;
  
    &lt;/div&gt;
  
    
  &lt;/div&gt;
  </code></pre>
    
  <p>APP.py</p>
  <pre><code>@app.route('/')
  @app.route('/loginform' , methods= ['GET','POST'])
  def loginform():
      # Check if &quot;username&quot; and &quot;password&quot; POST requests exist (user submitted form)
      print(&quot;herehere&quot;)
      if request.method == 'POST' and 'username' in request.form and 'password' in request.form:
      # Create variables for easy access
          print(&quot;Hellooo&quot;)
          username = request.form['username']
          password = request.form['password']
     #Check if account exists using MySQL
         cursor = mysql.connection.cursor()
         cursor.execute('SELECT * FROM accounts WHERE username = %s AND password = %s', (username,     password,))
      # Fetch one record and return result
        account = cursor.fetchone()
     
          if account is not None:
          # Create session data, we can access this data in other routes
              session['loggedin'] = True
              session['id'] = account['id']
              session['username'] = account['username']
          # Redirect to home page
              print(&quot;I am called&quot;)
              return redirect('Quickshop.html')
  else:
      print(&quot;now i am here&quot;)
      # Account doesnt exist or username/password incorrect
      msg = 'Incorrect username/password!'
      return render_template('loginform.html',msg = msg)
  </code></pre>