开始Flask项目
Posted 我是大王哈哈哈
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了开始Flask项目相关的知识,希望对你有一定的参考价值。
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>base</title> <link rel="stylesheet" href="../static/css/base.css" type="text/css"> <script src="../static/js/base.js"></script> </head> <body id="myBody"> <nav> <img id="myOnOff" onclick="mySwitch()" src="http://pic.58pic.com/58pic/12/38/64/52Y58PICFWV.jpg" width="100"height="50"> <a href="http://www.narutom.com/video/">首页</a> <input type="text"> <button>查找</button> <button><a href="{{ url_for(‘login‘) }}">登陆</a></button> </nav> <div class="area"> </div> <div class="area1"> <div class="img"> <a href="https://baike.baidu.com/item/%E6%BC%A9%E6%B6%A1%E9%B8%A3%E4%BA%BA/322717?fr=aladdin"><img src="http://img3.imgtn.bdimg.com/it/u=1024789900,1375050730&fm=214&gp=0.jpg"></a> <div class="desc"><a href="https://baike.baidu.com/item/%E6%BC%A9%E6%B6%A1%E9%B8%A3%E4%BA%BA/322717?fr=aladdin">漩涡鸣人</a></div> </div> <div class="img"> <a href="https://baike.baidu.com/item/%E5%AE%87%E6%99%BA%E6%B3%A2%E4%BD%90%E5%8A%A9"> <img src="http://dl.bizhi.sogou.com/images/2012/04/17/232306.jpg"></a> <div class="desc"><a href="https://baike.baidu.com/item/%E5%AE%87%E6%99%BA%E6%B3%A2%E4%BD%90%E5%8A%A9">宇智波佐助</a></div> </div> <div class="img"> <a href="https://baike.baidu.com/item/%E8%87%AA%E6%9D%A5%E4%B9%9F/7041?fr=aladdin"> <img src="http://img3.imgtn.bdimg.com/it/u=3803389959,1787876432&fm=214&gp=0.jpg"></a> <div class="desc"><a href="https://baike.baidu.com/item/%E8%87%AA%E6%9D%A5%E4%B9%9F/7041?fr=aladdin">自来也</a> </div> </div> </div> <br> <br> </body> </html>
from flask import Flask,render_template app = Flask(__name__) @app.route(‘/‘) def index(): return render_template(‘test.html‘) @app.route(‘/login‘) def login(): return render_template(‘login.html‘) if __name__ == ‘__main__‘: app.run(debug=True)
以上是关于开始Flask项目的主要内容,如果未能解决你的问题,请参考以下文章