Hi All,
I'm having some trouble serving a static XML stylesheet to accompany some dynamically generated output from a CherryPy web app. Even my test case serving a static text file fails.
Static file blah.txt
is in the /static
directory in my application root directory.
In my main site file (conesearch.py contains the CherryPy ConeSearch page-handler class):
import conesearch
cherrypy.config.update('site.config')
cherrypy.tree.mount(conesearch.ConeSearch(), "/ucac3", 'ucac3.config')
...
And in site.config
I have the following options:
[/]
tools.staticdir.root: conesearch.current_dir
[/static]
tools.staticdir.on: True
tools.staticdir.dir: 'static'
where current_dir = os.path.dirname(os.path.abspath(__file__))
in conesearch.py
However, my simple test page (taken straight from http://www.cherrypy.org/wiki/StaticContent) fails with a 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
It is trying to access 127.0.0.1:8080/static/blah.txt, which by my reckoning should be AOK. Any thoughts or suggestions?
Cheers,
Simon