ERROR:tornado.general:Could not open static file

一个人想着一个人 提交于 2019-12-12 04:44:19

问题


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.

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?


回答1:


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.



来源:https://stackoverflow.com/questions/33699159/errortornado-generalcould-not-open-static-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!