1
我有这样的文件夹结构:的CherryPy :::无法加载的index.html
index.html
tutorial -> public -> css -> style.css
tut.py
其中tutorial
是根。
内部tut.py
,我运行作为python tut.py
, 这个片段集根(教程):
if __name__ == '__main__':
conf = {
'/': {
'tools.sessions.on': True,
'tools.staticdir.root': os.path.abspath(os.getcwd())
和这个映射static
内容到公共:
'/static': {
'tools.staticdir.on': True,
'tools.staticdir.dir': './public'
}
也代码提供index.html
通过这个:
class StringGenerator(object):
@cherrypy.expose
def index(self):
return open('index.html')
里面的index.html:
<link href="/static/css/style.css" rel="stylesheet">
但是当我运行127.0.0.1
,html
没有被服务。哪里不对?
一切看起来不错。你遇到了什么错误? – jordeu