python flask log 1

做了Day 1 -3, 都真係好方便.

- 安置 flask pip install flask

- new app.py

from flask import Flask,render_template,url_for,redirect

app=Flask(__name__)

@app.route('/')
def index():
return render_template('index.html')

@app.route('/second')
def test():
return render_template('test.html')

@app.route('/third')
def testThird():
return redirect(url_for('index'))

if __name__ == '__main__':
app.run(host='0.0.0.0',port='5000',debug=True)


render_template 會認 templates.






- Run app.py,

python app.py

就改行到web





redirect 去index


留言

這個網誌中的熱門文章

香港袐密行動

要老是忘記, 我更記不起