本文介绍了Python Tornado 中的多个静态目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目录结构设置如下:

I have a directory structure setup like:

root/
  js/
  css/
  libs/
  index.html

从 Tornado 开始,我想将 js、css 和 libs 作为静态目录提供服务,但我只能找出如何为其中之一提供服务.可以这样做吗?

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?

推荐答案

不,这是不可能的.

您当然可以创建一个新文件夹 -- 父文件夹,并将 js、css 和 libs 放在该文件夹中,然后将该父文件夹指定为static_path"

You could ofcourse create a new folder -- parent, and place js, css and libs inside of that folder, and then speciy that parent folder as the 'static_path'

注意.在生产中,您可能希望从更优化的静态文件服务器(如 nginx"

nb. "In production, you probably want to serve static files from a more optimized static file server like nginx"

这篇关于Python Tornado 中的多个静态目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 11:20
查看更多