-
Notifications
You must be signed in to change notification settings - Fork 0
/
hello.py
51 lines (38 loc) · 1.08 KB
/
hello.py
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from flask import Flask
from flask import render_template
from flask import request
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!!!!!!!!!!!!!'
@app.route('/index',methods=['GET','POST'])
def index():
if request.method == 'POST':
url_date = {
'site':request.args.get('chewei'),
'num':request.args.get('num')
}
print(request.headers)
print(request.form)
return render_template("index.html", url_date=url_date)
else:
url_date = {
'site':request.args.get('chewei'),
'num':request.args.get('num')
}
return render_template("index.html",url_date = url_date)
@app.route('/url/<int:post_id>')
def url_fist(post_id):
return '你输入的数字为 %d' % post_id
@app.route('/hello/<username>')
def hello(username):
return"欢迎你 %s" % username
@app.route('/project/')
def pro():
return '打开网页'
@app.route('/adm')
def adm():
return '这是网页'
if __name__ == '__main__':
app.debug = True
app.run(host='0.0.0.0')