我的 /static/ dir 服务器端有一堆文件,其名称如下:
Slide0.html Slide121.html Slide143.html Slide165.html Slide187.html Slide208.html
Slide28.html Slide4.html Slide71.html Slide93.html
Slide100.html Slide122.html Slide144.html Slide166.html Slide188.html Slide209.html
我在同一个域中获取它们并定期将它们插入到 iframe 中,它们所做的只是渲染一些图像,但浏览器给出以下错误:
Resource interpreted as Image but transferred with MIME type text/html: "http://localhost:8888/static/Slide66.html".
我试图徒劳地继承静态文件处理程序:
class StaticHandler(tornado.web.StaticFileHandler):
def get(self, path):
abspath = os.path.abspath(os.path.join(self.root, path))
mime_type, encoding = mimetypes.guess_type(abspath)
if mime_type:
self.set_header("Content-Type", mime_type)
if 'Slide' in abspath:
self.set_header('Content-Type',"image/jpg" )
但错误仍然存在我如何调整它?