1.使用flask模板继承功能,这里有开始模板base.html。
2.下面的这些HTML文件都继承于上面的模板,有index.html,home.html,login.html
问题:前两个页面的小图标显示正常,但是login页面上的图标显示异常。
有差别
base.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="shortcut icon" href="{{url_for('static', filename='github.ico') }}" />
{% if title %}
<title>{{ title }}-欢迎来到微博客</title>
{% else %}
<title>欢迎来到微博客</title>
{% endif %}
</head>
<body>
<div>微博客:<a href="/home">主页</a></div>
<hr>
{% with messages = get_flashed_messages() %}
{% if messages %}
<ul>
{% for message in messages %}
<li>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
{% block content %}{% endblock %}
</body>
</html>
每个页面都是 {% extends "base.html" %} 这么做的,为什么不显示呢?
说道这里,使用火狐浏览器访问localhost:8080 无法显示图标,
貌似被拦截掉了,如何放开这个呢,如何设置??