Problems with Tornado and JavaScript libraries

I am trying to write a simple python web application using the Tornado web server and I am having problems using the JavaScript libraries that I need. I wanted to use the Protovis JavaScript Scrolling Library, so I added the following Hello World code snippet to my template.html:

<script type="text/javascript" src="/protovis-d3.2.js"></script>
<script type="text/javascript+protovis">
new pv.Panel()
    .width(150)
    .height(150)
    .anchor("center")
    .add(pv.Label)
        .text("Hello, world!")
        .root.render();
</script>

However, when I start the web server and try to access this page, I get the following error on the console:

WARNING:root:404 GET /protovis-d3.2.js (127.0.0.1) 0.46ms

The protovis.js file is in the same directory as the server.py file, and all its permissions are set correctly. I get the same error when trying the src file and JavaScript, so I know that there is no problem with the protovis.js file, but something with the Tornado server routing.

- , JavaScript, .

+5
1

.

, :

  • ''

  • :

    "static_path": os.path.join(os.path.dirname(), "" )

  • protovis-d3.2.js

  • /static/protovis-d2.2.js HTML
+13

All Articles