实训第十六天2022/7/27
9:00-10:00 -76
from flask import Flask,redirect,url_for
app = Flask(__name__)
@app.route('/admin')
def hello_admin():
return '<h1>hello admin<h1>'
@app.route('/guest/<guest>')
def hello_guest(guest):
return '<h1>hello %s as guest' % guest
@app.route('/user/<name>')
def hello_user(name):
if name == 'admin':
return redirect(url_for('hello_admin'))
else:
return redirect(url_for('hello_guest',guest=name))
@app.route('/')
def index():
return '<h1>hello world!</h1>'
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, debug=True)
10:35-12:00 -77
14:00-15:00 -78
16:00-17:00 -79
Bootstrap:自动响应屏幕,电脑、手机、平板都可以的。