Skip to content

Instantly share code, notes, and snippets.

@iOS0x00
Forked from omarish/server.py
Created October 23, 2013 08:10
Show Gist options
  • Save iOS0x00/7114496 to your computer and use it in GitHub Desktop.
Save iOS0x00/7114496 to your computer and use it in GitHub Desktop.
import tornado.web
class NoCacheStaticFileHandler(tornado.web.StaticFileHandler):
def set_extra_headers(self, path):
self.set_header("Cache-control", "no-cache")
class Application(tornado.web.Application):
def __init__(self):
handlers = [
# ...
url(r"/static/(.*)",
tornado.web.StaticFileHandler if not options.debug else NoCacheStaticFileHandler, {
"path": '/var/www/static'
}, name="static")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment