title: Flask 405 Error
body: <p>I keep getting this error when trying to insert some simple text into a db. </p>
  
  <pre><code>Method Not Allowed
  The method is not allowed for the requested URL."
  </code></pre>
  
  <p>I'm moving from PHP to python so bear with me here. </p>
  
  <p>The code is:</p>
  
  <pre><code>from flask import Flask, request, session, g, redirect, url_for, \
      abort, render_template, flash
  
  from flask.ext.sqlalchemy import SQLAlchemy
  
  app = Flask(__name__)
      app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://root:password@localhost/pythontest'
      db = SQLAlchemy(app)
      app = Flask(__name__)
  
  @app.route('/justadded/')
  def justadded():
      cur = g.db.execute('select TerminalError, TerminalSolution from Submissions order by id desc')
      entries = [dict(title=row[0], text=row[1]) for row in cur.fetchall()]
      return render_template('view_all.html', entries=entries)
  
  @app.route('/new', methods= "POST")
  def newsolution():
      if not request.method == 'POST':
          abort(401)
      g.db.execute('INSERT INTO Submissions (TerminalError, TerminalSolution, VALUES (?, ?)'
                  [request.form['TerminalError'], request.form['TerminalSolution']])
      g.db.commit()
      flash('Succesful')
      return redirect(url_for('justadded'))
  
  
  
  
  @app.route('/')
  def index():
      return render_template('index.html')
  
  @app.route('/viewall/')
  def viewall():
      return render_template('view_all.html')
  
  if __name__ == '__main__':
      app.run()
  </code></pre>
  
  <p>And the html code for the form is:</p>
  
  <pre><code>    &lt;form action="/new" method="POST"&gt;
          &lt;input name="TerminalError" id="searchbar" type="text"         placeholder="Paste Terminal error here..."&gt;
          &lt;input name="TerminalSolution" id="searchbar" type="text" placeholder="Paste Terminal solution here..."&gt;
          &lt;button type="submit" id="search" class="btn btn-primary"&gt;Contribute&lt;/button&gt;
          &lt;/form&gt;
  </code></pre>