Skip to content Skip to sidebar Skip to footer

Method Not Allowed The Method Is Not Allowed For The Requested URL. 405 Error

I am new to building API. I am building a very Simple API: When executed, The HTML page displaying API will ask to enter name: the Api will just return: 'Hello {name}'. I am gettin

Solution 1:

This question is now resolved. I changed two things:

From HTML: Changing:

<form action="{{ url_for('template')}}"method="post">

to

 <form action="{{ url_for('template')}}"method="get">

And Changing from Flask API:

output = [request.form.values()]
output = output[0]
return render_template('home.html',prediction_text='Hello {}'.format(output))

to

output = request.args.values()
return render_template('home.html',prediction_text="Hello {}?".format(list(output)[:]))

Post a Comment for "Method Not Allowed The Method Is Not Allowed For The Requested URL. 405 Error"