Mercurial > hg > index.fcgi > www > www-1
comparison pics2/pics_test_server.py @ 64:33e8f29e0941
update myrss/FEEDS
author | paulo |
---|---|
date | Wed, 24 Sep 2014 14:15:14 -0600 |
parents | 0249782e231e |
children |
comparison
equal
deleted
inserted
replaced
1:2a8a48e81800 | 2:d28596a51f87 |
---|---|
11 def sighandler(signum, frame): | 11 def sighandler(signum, frame): |
12 sys.stderr.write("Caught signal: %s \n" % signum) | 12 sys.stderr.write("Caught signal: %s \n" % signum) |
13 server.stop() | 13 server.stop() |
14 | 14 |
15 | 15 |
16 MIMETYPE = { | |
17 ".webm": "video/webm", | |
18 } | |
19 | |
20 | |
16 class FileServerRoot: | 21 class FileServerRoot: |
17 def default(self, *args): | 22 def default(self, *args): |
18 if len(args) == 0: | 23 if len(args) == 0: |
19 raise cherrypy.HTTPError(404) | 24 raise cherrypy.HTTPError(404) |
20 | 25 |
21 filepath = os.path.abspath(os.path.join(*args)) | 26 filepath = os.path.abspath(os.path.join(*args)) |
22 return cherrypy.lib.static.serve_file(filepath) | 27 ext = os.path.splitext(filepath)[1] |
28 return cherrypy.lib.static.serve_file(filepath, content_type=MIMETYPE.get(ext)) | |
23 | 29 |
24 default.exposed = True | 30 default.exposed = True |
25 | 31 |
26 | 32 |
27 if __name__ == "__main__": | 33 if __name__ == "__main__": |