【发布时间】:2015-01-04 16:16:21
【问题描述】:
我正在尝试执行以下操作:
文件结构如下:
/app
/static
/start
/css
/js
- index.html
/templates
我想知道如何在不使用 url_for('static', filename='') 或其他类型的服务槽 Flask 的情况下提供此 index.html 并使其加载其 CSS 和 JS。
基本上,我想把@987654321@ 和槽 Flask serve index.html 像<link href="css/style.css" rel="stylesheet">一样加载自己的css和js
我尝试了send_from_directory('/static/start', "index.html") 和app.send_static_file('index.html'),但它们不起作用。
我也尝试过current_app.send_static_file('start/index.html'),但这仅适用于 html。它不会让 index.html 加载自己的 CSS 和 JS。
我从这些链接中获得了信息
他们没有做我想做的事(或者我做错了)。
提前致谢,如果需要更多信息,请告诉我。
【问题讨论】: