标签:htm gis __name__ static debug body cli 不同 route
1 <html lang="en"> 2 <head> 3 <meta charset="UTF-8"> 4 <title>首页</title> 5 <script src="../static/js/base.js"></script> 6 <link type="text/css" rel="stylesheet" href="../static/css/login.css"> 7 </head> 8 <body> 9 <nav> 10 <img id="myOnOff" onclick="mySwitch()" 11 src="https://tva4.sinaimg.cn/crop.0.0.1242.1242.180/bde8475djw8f1hu7mrcy2j20yi0yiabl.jpg" width="30px"> 12 <a href="{{ url_for(‘index‘) }}">首页</a> 13 <a href="{{ url_for(‘regist‘) }}">注册</a> 14 <a href="{{ url_for(‘login‘) }}">登录</a> 15 </nav> 16 <div class="area"> 17 18 </div> 19 20 </body> 21 </html>
1 from flask import Flask,render_template 2 3 app = Flask(__name__) 4 5 @app.route(‘/‘) 6 def index(): 7 return render_template(‘switch切换.html‘) 8 9 @app.route(‘/login/‘) 10 def login(): 11 return render_template(‘login登录.html‘) 12 13 @app.route(‘/regist/‘) 14 def regist(): 15 return render_template(‘regist注册.html‘) 16 17 18 19 if __name__ == ‘__main__‘: 20 app.run(debug=True)
标签:htm gis __name__ static debug body cli 不同 route
原文地址:http://www.cnblogs.com/l-y-j/p/7776763.html