【发布时间】:2011-07-22 14:36:07
【问题描述】:
我开始学习cherrypy,但遇到了障碍。我无法获取静态文件来挽救我的生命。我收到了 404。The path '/static' was not found. 我已经用谷歌搜索过,但还没有找到解决方案。我想做的就是在http://localhost:8080/static提供文件
建议?
import os
import cherrypy
class Root(object):
@cherrypy.expose
def index(self):
pass
config = {
'/static':{
'tools.staticdir.on': True,
'tools.staticdir.dir': os.path.join(os.path.dirname(__file__), 'static')
}
}
cherrypy.tree.mount(Root(), '/', config = config)
cherrypy.engine.start()
【问题讨论】:
标签: cherrypy