1
0
mirror of https://github.com/sjlongland/tornado-gallery.git synced 2025-09-13 08:42:23 +10:00

server: Support serving up raw images.

If given a `/raw` path; serve up the raw file as-is without resizing.
This commit is contained in:
Stuart Longland 2018-04-18 18:01:38 +10:00
parent 2c04203a30
commit 43eb262fc6
Signed by: stuartl
GPG Key ID: 6AA32EFB18079BAA

View File

@ -9,7 +9,7 @@ import os.path
from tornado.web import Application, RequestHandler, \
RedirectHandler, MissingArgumentError
RedirectHandler, MissingArgumentError, StaticFileHandler
from tornado.httpclient import AsyncHTTPClient, HTTPError
from tornado.httpserver import HTTPServer
from tornado.locks import Semaphore
@ -232,6 +232,8 @@ class GalleryApp(Application):
(r"/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+\.[a-zA-Z]+)(?:/?[a-z]*\.html)?",
PhotoPageHandler),
(r"/([a-zA-Z0-9_\-]+)/?", GalleryHandler),
(r"/raw/([a-zA-Z0-9_\-]+/[a-zA-Z0-9_\-]+\.[a-zA-Z]+)",
StaticFileHandler, {"path": root_dir}),
(r"/", RootHandler),
],
static_url_prefix=static_uri,