I have a directory structure setup like:
root/
js/
css/
libs/
index.html
From Tornado, I want to serve js, css, and libs as static directories, but I can only find out how to serve one of them. Can this be done?
See https://stackoverflow.com/a/10165739/1813988
You can set the static path for different assets by setting handlers like this (and remove the static_path setting in Application):
handlers = [ (r'/favicon.ico', tornado.web.StaticFileHandler, {'path': favicon_path}), (r'/static/(.*)', tornado.web.StaticFileHandler, {'path': static_path}), (r'/', WebHandler) ]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With