Update fastapi-vue-setup 1.3.1 to avoid ruff errors. Fixed devserver script on platforms where Sanic needs AppServer.

This commit is contained in:
2026-05-02 05:03:43 +00:00
parent 922069c603
commit 2dea459d8f
8 changed files with 279 additions and 150 deletions
+12 -1
View File
@@ -4,11 +4,22 @@ from pathlib import Path
from fastapi_vue.hostutil import parse_endpoint
from sanic import Sanic
from sanic.worker.loader import AppLoader
from cista import config, server80
from cista.app import app
def load_app() -> Sanic:
"""Load the primary app in spawned worker processes.
Sanic's default multiprocess fallback looks up apps from the in-memory
registry, but that registry starts empty under the `spawn` start method.
Importing this module rebuilds the registry before returning the app.
"""
return app
def run(*, dev=False):
"""Run Sanic main process that spawns worker processes to serve HTTP requests."""
_url, opts = parse_listen(config.config.listen)
@@ -29,7 +40,7 @@ def run(*, dev=False):
access_log=False,
) # type: ignore[call-arg]
if dev:
Sanic.serve()
Sanic.serve(app_loader=AppLoader(factory=load_app))
else:
Sanic.serve_single()
+10 -1
View File
@@ -656,7 +656,16 @@ def watcher(loop):
while not stop_event.is_set():
if use_inotify:
inotify_tree = inotify.adapters.InotifyTree(rootpath.as_posix())
try:
inotify_tree = inotify.adapters.InotifyTree(rootpath.as_posix())
except OSError as e:
inotify_tree = None
use_inotify = False
logger.warning(
"Inotify watcher unavailable for %s; falling back to polling: %r",
rootpath,
e,
)
# Initialize the tree from filesystem
update_root(loop)