From 5c6862180b363e8c690ba807d9559b9f4ade89fc Mon Sep 17 00:00:00 2001 From: Correl Date: Wed, 21 Feb 2024 18:09:48 -0500 Subject: [PATCH] Trigger reload on openapi schema change --- tutor/server.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tutor/server.py b/tutor/server.py index 3a12412..299f52b 100644 --- a/tutor/server.py +++ b/tutor/server.py @@ -419,10 +419,13 @@ class StaticFileHandler(tornado.web.StaticFileHandler): class Application(tornado.web.Application): def __init__(self, **settings): version = importlib.metadata.version(__package__) - settings.setdefault( - "template_path", - importlib.resources.files(__package__) / "templates", - ) + template_path = importlib.resources.files(__package__) / "templates" + settings["template_path"] = str(template_path) + + if settings.get("autoreload"): + import tornado.autoreload + + tornado.autoreload.watch(str(template_path / "openapi.yaml")) paths = [ (