config - How to make cherrypy serve relative URLs like Apache -
(this on windows filesystem)
say have following htdocs dir structure:
c:\abc\htdocs index.html picture.jpg \js somescript.js and index.html looks this:
<html> <head> <title>apache vs cherrypy test</title> <script type="text/javascript" src="/js/somescript.js"></script> </head> <body> <img src='/picture.jpg' /> </body> </html> with apache, point httpd.conf's documentroot c:\abc\htdocs , index.html can access /picture.jpg , /js/somescript.js no special configs.
put way, html can reference relative urls no custom server config.
now switch cherrypy land.
i'm able cherrypy serve index.html, 404's on .jpg , .js files
there way cause cherrypy serve any htdocs-relative requested file (e.g. /picture.jpg and/or /js/somescript.js) without needing create explicit config entries each file and/or htdocs subdir?
i'd have expected able create simple config this:
[/] tools.staticfile.root = "c:\abc\htdocs" which allow access /picture.jpg , /js/somescript.js, doesn't work.
there simple way instruct cherrypy serve "wildcard" relative urls w/o needing provide file-specific entries in config?
staticfile individual files 1 @ time. try staticdir instead. see http://docs.cherrypy.org/dev/refman/lib/static.html#cherrypy.lib.static.staticdir config params can take. highly recommend setting "tools.staticdir.debug = true" while poke around. see http://docs.cherrypy.org/dev/progguide/files/static.html#serving-files-through-the-staticdir-tool prose using it.
Comments
Post a Comment