Serving static files¶
Tornado already has a static file handler, which has a little improvement in pyrocumulus. Using the pyrocumulus.web.handlers.StaticFileHandler you can set multiple directories to be used as root dir for static files in your settings file.
To use it is quite simple. First you need to set the variables STATIC_URL and STATIC_DIRS in your settings file.
STATIC_URL = '/static/' STATIC_DIRS = ['/home/me/somedir',]
Now, instantiate StaticApplication
from pyrocumulus.web.applications import StaticApplication staticapp = StaticApplication()
And, finally, put your staticapp in the APPLICATIONS settings variable
APPLICATIONS = ['myapp.web.staticapp', ..., ..., ...]