home > Serving Static Files (such as js, css and images)

Serving Static Files (such as js, css and images)

Problem

How to serve static files with the web.py server?

Solution

Create a directory (also known as a folder) called static in the location of the script that runs the web.py server. Then place the static files you wish to serve in the static folder.

For example, the URL http://localhost/static/logo.png will send the image ./static/logo.png to the client.

[edit][history][backlinks] last modified April 30