首页 > 解决方案 > 即使我的 HTML 文件在预览时可以显示,Flask 也不显示图像

问题描述

这是我的部门.html

{% extends 'layout.html' %}

{% block body %}
  <h1>Sectors Performance</h1>
  <p>
    <img src="../plot.png" width="1000" height="800" alt="graph">
  </p>
{% endblock %}

当我基本上独立运行时,图像会加载。但是当我使用整个 Flask 应用程序运行它时,图像不会显示。我还尝试将 plot.png 与ectors.html 文件放在同一个文件夹中,但在运行整个应用程序时无法加载,但如果sector.html 自行运行则加载。我很混乱。

目录布局:

App_Name  
- templates (folder)  
  - css (folder)
  - includes (folder)
  - js (folder)
  - sectors.html
  - other .html files
app.py
plot.png
sectors.py
other .py files

谢谢

标签: pythonpython-3.xflask

解决方案


推荐阅读