这个问题在这里已有答案:
我有一个图片文件夹,每个图片都属于一个博客中的帖子,每个图片都以.png扩展名的帖子ID命名。
创建页面时,为图片请求的URL是正确的,但奇怪的是它们被请求为text / html,页面返回404。
尝试显式引用图像路径,将static替换为path/to/uploads。
static
path/to/uploads
<img src="{{ url_for('static', filename = 'post.id.jpg') }}">