from flask import Flask,render_template app = Flask(__name__) @app.route(‘/‘) def index(): return render_template("base.html") @app.route(‘/login‘) def login(): return render_template("login.html") @app.route(‘/regis‘) def register(): return render_template("Zhuce.html") if __name__ == ‘__main__‘: app.run(debug=True)
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>首页</title> <link type="text/css" rel="stylesheet" href="{{ url_for(‘static‘,filename=‘css/index.css‘) }}"> </head> <body> <a href="{{ url_for(‘login‘) }}">注册</a> </body> </html> 复制代码
原文:http://www.cnblogs.com/coffee2/p/7780561.html