Http server
fumanchu
fumanchu at amor.org
Tue Dec 19 16:21:06 EST 2006
Gert Cuykens wrote:
> so far this works
>
> <code>
> import cherrypy
> import os.path
>
> class Http:
>
> def index(self):
> f = open(os.path.join(os.path.dirname(__file__), '../htm/index.htm'))
> xml = f.read()
> f.close()
> return xml
> index.exposed = True
>
> cherrypy.tree.mount(Http())
>
> if __name__ == '__main__':
> cherrypy.config.update(os.path.join(os.path.dirname(__file__),
> 'server.conf'))
> cherrypy.server.quickstart()
> cherrypy.engine.start()
> </code>
>
> I would like a cute secretary for Christmas but i dont think i will
> get one. So i need to find a way to scan a directory. And map all
> files inside the directory and generate a class member like
>
> <code>
> def filename(self):
> f = open(os.path.join(os.path.dirname(__file__), '../htm/filename'))
> xml = f.read()
> f.close()
> return xml
> filename.exposed = True
> </code>
>
> Any idea or cute secretary maybe ?
The cute secretary's name is "cherrypy.tools.staticdir".
Check out her resume at http://www.cherrypy.org/wiki/StaticContent
Robert Brewer
System Architect
Amor Ministries
fumanchu at amor.org
More information about the Python-list
mailing list