From: Michael Tremer Date: Tue, 14 Mar 2023 11:03:28 +0000 (+0000) Subject: web: Serve any static files locally X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0ed3ea5ca26911c01dc1de28cf8343c3ccc236ce;p=ipfire.org.git web: Serve any static files locally This allows to run the web app for development without Apache in front Signed-off-by: Michael Tremer --- diff --git a/src/web/__init__.py b/src/web/__init__.py index 73193917..8254593c 100644 --- a/src/web/__init__.py +++ b/src/web/__init__.py @@ -159,6 +159,9 @@ class Application(tornado.web.Application): # Export arbitrary error pages (r"/error/([45][0-9]{2})", base.ErrorHandler), + + # Serve any static files + (r"/static/(.*)", tornado.web.StaticFileHandler, { "path" : self.settings.get("static_path") }), ]) # blog.ipfire.org - LEGACY REDIRECTION @@ -221,6 +224,9 @@ class Application(tornado.web.Application): # Send profiles (r"/send/([a-z0-9]+)", fireinfo.ProfileSendHandler), + + # Serve any static files + (r"/static/(.*)", tornado.web.StaticFileHandler, { "path" : self.settings.get("static_path") }), ] + authentication_handlers) # i-use.ipfire.org @@ -249,6 +255,9 @@ class Application(tornado.web.Application): (r"/", nopaste.CreateHandler), (r"/raw/(.*)", nopaste.RawHandler), (r"/view/(.*)", nopaste.ViewHandler), + + # Serve any static files + (r"/static/(.*)", tornado.web.StaticFileHandler, { "path" : self.settings.get("static_path") }), ] + authentication_handlers) # location.ipfire.org @@ -258,6 +267,9 @@ class Application(tornado.web.Application): (r"/how\-to\-use", StaticHandler, { "template" : "../location/how-to-use.html" }), (r"/lookup/(.+)/blacklists", location.BlacklistsHandler), (r"/lookup/(.+)", location.LookupHandler), + + # Serve any static files + (r"/static/(.*)", tornado.web.StaticFileHandler, { "path" : self.settings.get("static_path") }), ]) # geoip.ipfire.org @@ -302,6 +314,9 @@ class Application(tornado.web.Application): # Stats (r"/stats", people.StatsHandler), + # Serve any static files + (r"/static/(.*)", tornado.web.StaticFileHandler, { "path" : self.settings.get("static_path") }), + # API (r"/api/check/email", auth.APICheckEmail), (r"/api/check/uid", auth.APICheckUID), @@ -329,6 +344,9 @@ class Application(tornado.web.Application): (r"([A-Za-z0-9\-_\/]+)?/_files", wiki.FilesHandler), (r"((?!/static)(?:[A-Za-z0-9\-_\/]+)?(?:.*)\.(?:\w+))$", wiki.FileHandler), + # Serve any static files + (r"/static/(.*)", tornado.web.StaticFileHandler, { "path" : self.settings.get("static_path") }), + # Render pages (r"([A-Za-z0-9\-_\/]+)?", wiki.PageHandler), ])