问题
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