静态文件的加载需要先兴建文件夹 static ,在文件夹下新建 css ,js 和images ,同时要使用url_for 函数
image.png

js

在静态文件index.html 中引入jquery.js 文件

  1. <script src="{{ url_for('static',filename='js/jquery-3.3.1.js') }}"> </script>
<script type="text/javascript" src="static/js/jquery-3.3.1.js"></script>
<head>
    <script src="{{ url_for('static',filename='js/jquery-3.3.1.js') }}"> </script>
    <script ></script>
    <meta charset="UTF-8"> <!--设置网页编码-->
    <title>这是首页</title> <!--设置网页标题 -->
    <h1> 这是首页文字</h1> <!--h1 标题-->
</head>

css

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

images

<img src="{{ url_for('static',filename='images/ampere.png') }}"></img>