python - 即使我的 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
谢谢
解决方案
推荐阅读
- angular - 如何将图标添加到 mat-table 中的 mat-sort-header
- web-services - 关闭应用程序时,Android 服务无法连接到 Web 服务
- hyperledger-fabric - 在 Hyperledger Fabric 中,如果无法使用 peer channel fetch 命令,如何加入频道?
- rxjs - 更新订阅中的值
- c# - 通过 web api 授权 azure 活动目录
- laravel - 试图获取非对象的属性“parent_id”
- linux - 被屏蔽的信号会丢失或排入队列吗?
- winforms - 在远程 Windows Server 上复制小文件需要时间
- spring-boot - Spring Boot:记录属性
- javascript - 如何在javascript函数中使用/绑定角度变量