निर्माणाधीन:फ्लास्क (पाइथन)/यूजर इनपुट
static/index.html
सम्पादन<form name="form" method="post" action"" >
<label for="name">Enter your name:</label>
<input name="name" type="text">
<input type="submit" value="Submit">
</form>
app.py
सम्पादनfrom flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def root():
if request.method == "GET":
return render_template('index.html')
elif request.method == "POST":
return "Hello " + request.form['name'] + "!"
else:
return "Unexpected request.method: " + request.method
if __name__ == '__main__':
app.run(host='0.0.0.0', port='5000')