Flask之加载静态资源

1.加载css样式

<link rel="stylesheet" href="{{ url_for('static',filename='css/img.css',_external=True) }}">

2.加载js脚本

<script rel="stylesheet" src="{{ url_for('static',filename='js/img.js') }}"></script>

3.加载图片

<img src="{{ url_for('static',filename='img/g2.jpg' )}}">

4.修改页面title位置的图标

 <link rel="icon" type="image/x-icon" href="{{ url_for('static',filename='favicon.ico') }}" />

猜你喜欢

转载自blog.csdn.net/qq_42055440/article/details/80667980