Skip to content

Commit

Permalink
granian is funny
Browse files Browse the repository at this point in the history
  • Loading branch information
adhami3310 committed Feb 15, 2025
1 parent 6b03346 commit 434e794
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion reflex/reflex.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
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]
Expand Down Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions reflex/utils/exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)


Expand Down

0 comments on commit 434e794

Please sign in to comment.