Chapter 18.2.3. Configuring Apache to Serve Static Content Directly

Chances are, your web server will be faster than CherryPy for serving static files. So, you should take advantage of this. Fortunately, it is trivial to achieve this with mod_rewrite:

RewriteEngine on
RewriteRule ^/static(.*) /home/myuser/static$1 [L]
RewriteRule ^(.*) http://127.0.0.1:8000$1 [P]

This way, if you have a static file /home/myuser/static/foo.html, it will be available at http://<domain>/static/foo.html.

Get Rapid Web Applications with TurboGears: Using Python to Create Ajax-Powered Sites now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.