CherryPyWebアプリから動的に生成された出力を伴う静的XMLスタイルシートを提供するのに問題があります。静的テキストファイルを提供する私のテストケースでさえ失敗します。
静的ファイル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であるはずです。何か考えや提案はありますか?
乾杯、
サイモン