-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
27 lines (20 loc) · 725 Bytes
/
Copy pathtest.py
File metadata and controls
27 lines (20 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route("/test", methods=['GET', 'POST'], endpoint="test")
def test():
if request.method == 'GET':
return render_template("test.html")
if request.method == 'POST':
sentence = request.form['sentence']
return "hello, your sentence is {}".format(sentence)
@app.route("/", methods=['GET', 'POST'])
def index():
if request.method == 'GET':
return render_template("test.html")
if request.method == 'POST':
name = request.form['name']
password = request.form['password']
return "hello" + name + "pass:" + password
if __name__ == "__main__":
# TODO: model init
app.run()