【问题标题】:ERROR:tornado.general:Could not open static file错误:tornado.general:无法打开静态文件
【发布时间】:2015-11-13 18:06:34
【问题描述】:

我正在编写一个 tornado web 应用程序,并有一个名为“static”的文件,其中包含 main.js、require.js、elasticsearch.js 和 d3.v3.js 等文件。最后三个只是 javascript 库的源代码。

在我的 index.html 文件中,我有这些行

    <script>src={{ static_url("scripts/require.js") }}></script>
    <script>require([{{ static_url("scripts/main.js") }}], function () {})</script>

现在当我运行应用程序时,我收到两个错误:

ERROR:tornado.general:Could not open static file '...'

对于我正在阅读的两个文件中的每一个。有没有人遇到过类似的问题或对为什么会发生这种情况有任何见解?

【问题讨论】:

    标签: javascript tornado


    【解决方案1】:

    js 文件是直接在static 目录中还是在scripts 子目录中?假设您在创建应用程序时执行了 static_path="static" 之类的操作,则文件需要位于 static/scripts/*.js 中以匹配您在 static_url 调用中使用的路径。

    【讨论】:

      猜你喜欢
      • 2013-10-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-05
      相关资源
      最近更新 更多