Swarn Kiran
Swarn Kiran

Reputation: 21

post method 405 error in bottle python

I trying to use post method, but getting error 405. This is my python code:

@route('/')
def home():
    return template('driver_homepage(2)')
@route('/submit' , methods = ['GET', 'POST', 'PUT'])
     def calculate():
     zone  = request.form['zone']
     #...... 
     ans = eligorithm.Estimation
     return template('driver_finalpage-2')
     #return template('driver_finalpage-2', ans=ans)
run(reloader=True)

when I click on my calculate button on HTML page, instead of going to driver_finalpage-2(tis page is in .tpl and .html, I m using .tpl here) showing an error. HTML form:

<form method="post" action="/submit">     
<!-- ...(in here taking input in various fields) -->
<input class="btn btn-primary" type="submit" value="Calculate">

Please help.

Upvotes: 0

Views: 142

Answers (1)

dimmg
dimmg

Reputation: 3835

You may try to change methods to method as follows

@route('/submit' , method=['GET', 'POST', 'PUT'])
def calculate():
    ...

Upvotes: 1

Related Questions