Hans-Inge
Hans-Inge

Reputation: 3

Is there no way to serve a static directory and its children i Cherrypy?

Using Cherrypy version 3.0.2

Given a file-structure like this:

static-dir 2011 2010 2009 ...

I use the configuration: '/static': {'tools.staticdir.on': True, 'tools.staticdir.dir': 'static-dir'}

This works fine fore getting /static/anyfile

But if I try /static/2009/anyfile I get an error. I can add an entry in the configuration for this directory like: '/static/2009': {'tools.staticdir.on': True, 'tools.staticdir.dir': 'static-dir/2009'}

This works, but it there no other way to serve sub-directory’s? Do I have to enter every directory under static-dir in then configuration to serve them?

Upvotes: 0

Views: 385

Answers (2)

fumanchu
fumanchu

Reputation: 14559

You shouldn't have to enter multiple entries; it should descend as far down as you need to. What error are you getting? 404? If you're using Cherrypy 3.2, try setting 'tools.staticdir.debug' to True.

Upvotes: 1

Tyler Eaves
Tyler Eaves

Reputation: 13121

Not sure in CherryPY, but why not configure your front end webserver to serve static files? You really don't want that traffic hitting your framework.

Upvotes: 1

Related Questions