from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def jianshu():
return render_template('jianshu.html')
@app.route('/login/')
def login():
return render_template("login.html")
@app.route("/enroll/")
def enroll():
return render_template('enroll.html')
if __name__ == '__main__':
app.run(debug=True)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>
{% block title %}{% endblock %}
首页</title>
<link type="text/css" rel="stylesheet" href="{{ url_for('static',filename='css/jianshu.css') }}">
<script src="{{ url_for('static',filename='js/nightmode.js') }}">
</script>
{% block head %}{% endblock %}
</head>
<body id="mybody">
<nav>
<img src="https://p1.ssl.qhmsg.com/dr/270_500_/t01745b3fd4078d5a9e.jpg?size=512x512" height="100" width="10">
<a href="http://www.jianshu.com/"></a>
<input type="text" name="search">
<button type="submit">搜索</button>
<a href="{{ url_for('jianshu') }}">首页</a>
<a href="{{ url_for('login') }}">登陆</a>
<a href="{{ url_for('enroll') }}">注册</a>
<img src="{{ url_for('static',filename='img/dog.png') }}" alt="" height="100">
<img id="myonoff" onclick="mySwitch()" src="http://www.runoob.com/images/pic_bulbon.gif" height="100">
</nav>
{% block main %}{% endblock %}
</body>
</html>