flask页面的跳转测试
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css"> <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script> <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script> <title>Insert title here</title> <style type="text/css"> *{ padding:0px; margin:0px; } .header{ 100%; height:120px; background-color:brown; text-align:center; position:relative; } .contain{ 100%; height:780px; position:relative; background-color:blue; } .list-group{ 15%; float:left; } a{ text-decoration:none; 100%; } .list-group a:hover{ font-size:18px; font-weight:bold; } .operation{ 85%; height:780px; float:right; } iframe{ border:0px; } .loginfoshow{ position:absolute; auto; text-align:right; bottom:5px; right:5px; } .loginfoshow a { color:#D8D8D8; cursor:pointer; } .loginfoshow a:hover { color:white; } .loginfoshow p{ float:left; color:white; } </style> <script> </script> </head> <body onload="onload()"> <div class="header"> <h2>新闻文本分析及相关性展示</h2> <div class="loginfoshow" id="userinfor"> <p id="informationshow"></p> </div> </div> <div class="contain"> <div class="list-group"> <a href="{{ url_for('index') }}" class="list-group-item list-group-item-aciton" target="operation">咨询</a> </div> <div class="operation"> <iframe name="operation" src="" width="100%" height="100%" style="background-color: gray;"></iframe> </div> </div> <div class="footer"></div> </body> </html>
from flask import Flask, render_template app = Flask(__name__) @app.route('/') def hello_world(): return render_template('test.html', error=True) @app.route('/index') def index(): return render_template('my1.html') if __name__ == '__main__': app.run()
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>咨询</title> </head> <body> 123456 </body> </html>