错误:tornado.general:无法打开静态文件 [英] ERROR:tornado.general:Could not open static file

查看:38
本文介绍了错误:tornado.general:无法打开静态文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm writing a tornado web app and have a file named "static" with files such as main.js, require.js, elasticsearch.js, and d3.v3.js. The last three are just source code for the javascript libraries.

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

In my index.html file I have the lines

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

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

Now when I run the app, I get two errors:

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

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

for each of my two files that I'm reading in. Has anyone ever had a similar issue or have any insights as to why this is happening?

推荐答案

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

Are the js files directly in the static directory or in a scripts subdirectory? Assuming you did something like static_path="static" when creating the application, the files need to live in static/scripts/*.js to match the paths you use in your static_url call.

这篇关于错误:tornado.general:无法打开静态文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆