I'm running into some difficulties executing Flask code.
I have an HTML form which looks like this:
<form action="index">
<input type="text" name="name" placeholder="name">
<input type="text" name="age" placeholder="age">
<input type="submit" name="submit" value="add">
<input type="submit" name="submit" value="retrieve">
</form>
So it should call the @app.route()
thing I have here, no?
@app.route('index', methods=['POST', 'GET'])
def index():
...
But it doesn't! I've been googling and trying to consult flask's docs for quite some time but I'm just having a really hard time understanding how this stuff works.
When I submit the form, it returns to the page, which is desired. But, the code in index()
is not being executed. This I know with 100% certainty the code in index()
is not being executed because the first line is a return statement with a string that reads "Hello, world!" and it does not appear.
How do I execute the code in this method?
Thank you!