granian is funny

This commit is contained in:
Khaleel Al-Adhami 2025-02-14 18:18:58 -08:00
parent 6b03346130
commit 434e794412
2 changed files with 7 additions and 4 deletions

View File

@ -15,6 +15,7 @@ from reflex.config import environment, get_config
from reflex.custom_components.custom_components import custom_components_cli
from reflex.state import reset_disk_state_manager
from reflex.utils import console, telemetry
from reflex.utils.exec import should_use_granian
# Disable typer+rich integration for help panels
typer.core.rich = None # pyright: ignore [reportPrivateImportUsage]
@ -206,7 +207,9 @@ def _run(
)
# Get the app module.
prerequisites.get_compiled_app()
if not should_use_granian():
# Granian fails if the app is already imported.
prerequisites.get_compiled_app()
# Warn if schema is not up to date.
prerequisites.check_schema_up_to_date()

View File

@ -216,9 +216,6 @@ def run_backend(
frontend_present: Whether the frontend is present.
"""
web_dir = get_web_dir()
# Create a .nocompile file to skip compile for backend.
if web_dir.exists():
(web_dir / constants.NOCOMPILE_FILE).touch()
if not frontend_present:
notify_backend()
@ -227,6 +224,9 @@ def run_backend(
if should_use_granian():
run_granian_backend(host, port, loglevel)
else:
# Create a .nocompile file to skip compile for backend.
if web_dir.exists():
(web_dir / constants.NOCOMPILE_FILE).touch()
run_uvicorn_backend(host, port, loglevel)