From: Michael Tremer Date: Fri, 9 May 2025 14:12:44 +0000 (+0000) Subject: webapp: Serve the frontend application X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a8429fab36876f53d0bb860aab4492bcf0df3368;p=people%2Fms%2Fwestferry.git webapp: Serve the frontend application Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 4ceab27..f6545f9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -320,7 +320,6 @@ substitutions = \ '|configsdir=$(configsdir)|' \ '|bindir=$(bindir)|' \ '|datadir=$(datadir)|' \ - '|templatesdir=$(templatesdir)|' \ '|webrootdir=$(webrootdir)|' SED_PROCESS = \ diff --git a/src/westferry/application.py b/src/westferry/application.py index 0898940..b2befb6 100644 --- a/src/westferry/application.py +++ b/src/westferry/application.py @@ -19,6 +19,7 @@ # # ############################################################################### +import os.path import tornado.web from . import backend @@ -33,11 +34,12 @@ class WebApplication(tornado.web.Application): # Enable compressed output "compress_response" : True, - # Serve static files from our webroot - "static_path" : WEBROOTDIR, - # Templates - "template_path" : TEMPLATESDIR, + "template_path" : WEBROOTDIR, + + # Serve assets + "static_path" : os.path.join(WEBROOTDIR, "assets"), + "static_url_prefix" : "/assets/", # Use Cross-Site-Request-Forgery protection "xsrf_cookies" : True, diff --git a/src/westferry/constants.py.in b/src/westferry/constants.py.in index 0e4d6c2..e7c9344 100644 --- a/src/westferry/constants.py.in +++ b/src/westferry/constants.py.in @@ -22,5 +22,4 @@ PACKAGE_NAME = "@PACKAGE_NAME@" PACKAGE_VERSION = "@PACKAGE_VERSION@" -TEMPLATESDIR = "@templatesdir@" WEBROOTDIR = "@webrootdir@" diff --git a/src/westferry/handlers/index.py b/src/westferry/handlers/index.py index 097d4ab..35b65a1 100644 --- a/src/westferry/handlers/index.py +++ b/src/westferry/handlers/index.py @@ -28,4 +28,4 @@ class IndexHandler(base.BaseHandler): #@tornado.web.authenticated def get(self): - self.render("base.html") + self.render("index.html")