CherryPy Project Download

Since this page was empty and I can't find how to create a new one, here goes:

Static Images in Cherrypy

Here is a simple example of a staci image served by Cherrypy.

import cherrypy

class Root:
    def index(self):
        return """ <html>
<title>CherryPy static imagl</title>
<img src="images/today.png">

cherrypy.config.update({'server.socket_host': '',
                            'server.socket_port': 80, })

conf = {'/images': {'tools.staticdir.on': True,
        'tools.staticdir.dir': '/home/eur/cherrypy/images'}}
print conf
cherrypy.quickstart(Root(), '/', config=conf)

Yes, this has an actual directory in it, which will be different on your system.

Hosted by WebFaction

Log in as guest/cherrypy to create/edit wiki pages