我在为一个静态XML样式表提供服务时遇到了一些问题,这个静态XML样式表伴随着一个CherryPy web应用程序动态生成的输出。即使我的测试用例为静态文本文件服务也失败了。
静态文件blah.txt
位于应用程序根目录中的/static
目录中。
在我的主站点文件(conesearch.py包含CherryPy conesearch页面处理程序类)中:
import conesearch
cherrypy.config.update('site.config')
cherrypy.tree.mount(conesearch.ConeSearch(), "/ucac3", 'ucac3.config')
...
在site.config
中,我有以下选项:
[/]
tools.staticdir.root: conesearch.current_dir
[/static]
tools.staticdir.on: True
tools.staticdir.dir: 'static'
其中current_dir = os.path.dirname(os.path.abspath(__file__))
在conesearch.py
中
但是,我的简单测试页(直接从http://www.cherrypy.org/wiki/StaticContent获取)失败,出现404:
def test(self):
return """
<html>
<head>
<title>CherryPy static tutorial</title>
</head>
<body>
<a href="/static/blah.txt">Link</a>
</body>
</html>"""
test.exposed = True
它试图访问127.0.0.1:8080/static/blah.txt,据我估计应该是AOK。有什么想法或建议吗?
干杯
西蒙
目前没有回答
相关问题 更多 >
编程相关推荐