python - Sending Data from html to Flask -
so i'm trying send data html form python flask framework. here's example of html code i'm using
<form method=post action=/test> <input name=name value=austin type=hidden><input type=submit value="add notification">
and here's python flask i'm working with
@app.route('/test', methods=('get', 'post') def test_page(): v = request.values.get('name') return v
i've tried many different request methods , can't seem work , 405 error. i'm not familiar flask web development or using post requests. if point me in correct direction that'd great!
you're post
ing endpoint, app.route
default enables get
. change app.route('/test')
app.route('/test', methods=('get', 'post'))
, , you'll able access endpoint.
that 405
response you're getting method not allowed.
(unrelated issue, request.values.get['name']
should request.values.get('name')
.)
Comments
Post a Comment