From daf21d0afdbd474a86c4b4550392b4442f2e23d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Fri, 8 Apr 2022 11:49:40 +0200 Subject: [PATCH] find custom static folder --- src/capport/api/app_cls.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/capport/api/app_cls.py b/src/capport/api/app_cls.py index f7e8220..e2eba7c 100644 --- a/src/capport/api/app_cls.py +++ b/src/capport/api/app_cls.py @@ -34,10 +34,15 @@ class MyQuartApp(quart_trio.QuartTrio): def __init__(self, import_name: str, **kwargs) -> None: self.my_config = capport.config.Config.load_default_once() kwargs.setdefault('template_folder', os.path.join(os.path.dirname(__file__), 'templates')) - kwargs.setdefault('static_folder', os.path.join(os.path.dirname(__file__), 'static')) cust_templ = os.path.join('custom', 'templates') if os.path.exists(cust_templ): self.custom_loader = jinja2.FileSystemLoader(os.fspath(cust_templ)) + cust_static = os.path.abspath(os.path.join('custom', 'static')) + if os.path.exists(cust_static): + static_folder = cust_static + else: + static_folder = os.path.join(os.path.dirname(__file__), 'static') + kwargs.setdefault('static_folder', static_folder) super().__init__(import_name, **kwargs) self.debug = self.my_config.debug self.secret_key = self.my_config.cookie_secret