-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhello.py~
More file actions
32 lines (27 loc) · 724 Bytes
/
hello.py~
File metadata and controls
32 lines (27 loc) · 724 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
28
29
30
31
32
from flask import Flask,url_for,render_template
app = Flask(__name__)
@app.route('/')
def index():
return 'Index Page'
@app.route('/user/<username>')
def show_user_profile(username):
return 'User is %s' % username
@app.route('/post/<int:post_id>')
def show_post(post_id):
return 'Post %d' % post_id
@app.route('/login',methods=['GET','POST'])
def login():
if request.method == 'POST':
do_the_login()
else:
show_the_login_form()
@app.route('/hello/')
@app.route('/hello/<name>')
def hello(name=None):
return render_template('hello.html',name=name)
@app.route('/data/<name>')
def showdata():
data=['apple','pear','banana']
return render_template('showdata.html',data=data)
if __name__=='__main__':
app.run()