0

I just want to start up a server, point it at a directory and have it serve static files. I thought cherryd would be good/easy for that.

I've read the cherryd usage and a good portion of the online docs, as well as posts here about static files and CherryPy, but I've yet to find information about a bare configuration file for cherryd. I've been able to piece together the following:

[global]
server.socket_host: "127.0.0.1"
server.socket_port: 8000
log.error_file = '/Users/chb/code/app/test/log/cherrypy.error.log'

[/]
tools.staticdir.on: True
tools.staticdir.root: '/Users/chb/code/app'
tools.staticdir.dir: '.'

I also tried this alternate configuration:

[global]
server.socket_host: "127.0.0.1"
server.socket_port: 8000
log.error_file = '/Users/chb/code/app/test/log/cherrypy.error.log'

[/]
tools.staticdir.root: '/Users/chb/code/app'

[/index.html]
tools.staticfile.on: True
tools.staticfile.filename: '/Users/chb/code/app/index.html'

The latter adheres more to the docs (see below).

Visiting 127.0.0.1:8000 gets me a 404. When I tail the error log after running cherryd -c /path/to/cherryd.cfg, nothing comes up apart from the standard startup info.

This question relates to CherryPy 3.2.2 and Python 2.7.3

Relevant pages in the docs:

chb
  • 1,727
  • 7
  • 25
  • 47
  • 2
    If only I had known about [`$ python -m SimpleHTTPServer [port]`](http://stackoverflow.com/a/759666/148680) – chb Jul 01 '12 at 20:12
  • In Python 3, the above would be `$ python -m http.server [port]` (see [PEP 3108](https://www.python.org/dev/peps/pep-3108/#http-package)) – chb Jun 05 '16 at 10:11

1 Answers1

1

My error was in thinking that cherryd is a simple HTTP daemon that can run absent a user-created Python script.

What I wanted was something like lighttpd. I came across this document and wondered if there was something simliar implemented in Python.

Fortunately, after some more searching I came across the one-liner mentioned in the comments to the original post.

Community
  • 1
  • 1
chb
  • 1,727
  • 7
  • 25
  • 47