This simple code will serve files on current directory.
import os
import cherrypy
PATH = os.path.abspath(os.path.dirname(__file__))
class Root(object): pass
cherrypy.tree.mount(Root(), '/', config={
'/': {
'tools.staticdir.on': True,
'tools.staticdir.dir': PATH,
'tools.staticdir.index': 'index.html',
},
})
cherrypy.quickstart()
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…