static files
illustrate
During the development process, generally:
- picture
- CSS
- js
will be treated as static files.
static directory
1. 自定义app
Create a static folder in the directory. We create an img folder under static and put the 1.png image in it
Then modify <app>/templates/index.html
the file
<!DOCTYPE html>
{% load static %}
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1>hello templates </h1>
<img src="{% static 'img\1.png' %}">
</body>
</html>
In this way png is introduced