]> git.ipfire.org Git - ipfire.org.git/commitdiff
web: Serve any static files locally
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 14 Mar 2023 11:03:28 +0000 (11:03 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 14 Mar 2023 11:03:28 +0000 (11:03 +0000)
This allows to run the web app for development without Apache in front

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/web/__init__.py

index 7319391737d602474e9b97dd769aa0ab7e67da76..8254593c8a6243cdc0a4339757daa6b777a8eab9 100644 (file)
@@ -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),
                ])