请求HTML作为text / html [复制]

问题描述 投票:-1回答:1

这个问题在这里已有答案:

我有一个图片文件夹,每个图片都属于一个博客中的帖子,每个图片都以.png扩展名的帖子ID命名。

创建页面时,为图片请求的URL是正确的,但奇怪的是它们被请求为text / html,页面返回404。

The pictures are not found (404)

The pictures are requested as text/html

An <img> with the src set to the correct source of the pictures

python html css flask
1个回答
1
投票

尝试显式引用图像路径,将static替换为path/to/uploads

<img src="{{ url_for('static', filename = 'post.id.jpg') }}">  
© www.soinside.com 2019 - 2024. All rights reserved.