【发布时间】:2011-09-07 15:47:21
【问题描述】:
我最近问了这个相关的问题: Problems serving static files favicon.ico and robots.txt in CherryPy 3.1
在我的配置文件中,我描述了一个绝对路径。有没有办法让它成为相对路径?原因是我在一个团队中。我的队友和我的服务器使用不同的路径来定位我们的代码。
[/]
tools.staticdir.on = True
tools.staticdir.root = "/projects/mysite/trunk/root"
tools.staticdir.dir = ""
tools.staticfile.root = "/projects/mysite/trunk/root"
[/favicon.ico]
tools.staticfile.on = True
tools.staticfile.filename = "images/favicon.ico"
[/robots.txt]
tools.staticfile.on = True
tools.staticfile.filename = "robots.txt"
[/images]
tools.staticdir.on = True
tools.staticdir.dir = "images"
[/css]
tools.staticdir.on = True
tools.staticdir.dir = "css"
[/js]
tools.staticdir.on = True
tools.staticdir.dir = "js"
【问题讨论】:
-
相对于起始 python 文件所在的位置。加载此配置文件的 Python 文件。