user3721069
user3721069

Reputation:

405 Method not allowed with POST + Flask

I've been finding a 405 error when I try to pass a form by POST to a python script using flask.

My Python is like this:

@app.route('/make', methods=['POST', 'GET'])
def make():
    if request.method == 'POST':
        return "its working"

My form is like this:

<form method="POST" target="/make">
        <div id="Question">
</form>

My code is kinda big so I'm not reproducing it entirely. I cant seem to find my mistake. What am I doing wrong?

Upvotes: -1

Views: 1040

Answers (1)

user8060120
user8060120

Reputation:

In your form you need to use action instead of target

<form method="POST" action="/make">
        <div id="Question">
</form>

more details: form_action

Upvotes: 1

Related Questions