MCPcopy Index your code
hub / github.com/reflex-dev/reflex / run_backend

Function run_backend

reflex/utils/exec.py:449–478  ·  view source on GitHub ↗

Run the backend. Args: host: The app host port: The app port loglevel: The log level. frontend_present: Whether the frontend is present.

(
    host: str,
    port: int,
    loglevel: constants.LogLevel = constants.LogLevel.ERROR,
    frontend_present: bool = False,
)

Source from the content-addressed store, hash-verified

447
448
449def run_backend(
450 host: str,
451 port: int,
452 loglevel: constants.LogLevel = constants.LogLevel.ERROR,
453 frontend_present: bool = False,
454):
455 """Run the backend.
456
457 Args:
458 host: The app host
459 port: The app port
460 loglevel: The log level.
461 frontend_present: Whether the frontend is present.
462 """
463 web_dir = get_web_dir()
464 # Create a .nocompile file to skip compile for backend.
465 if web_dir.exists():
466 (web_dir / constants.NOCOMPILE_FILE).touch()
467
468 if not frontend_present:
469 notify_backend(host)
470
471 # Run the backend in development mode.
472 if should_use_granian():
473 # We import reflex app because this lets granian cache the module
474 import reflex.app # noqa: F401
475
476 run_granian_backend(host, port, loglevel)
477 else:
478 run_uvicorn_backend(host, port, loglevel)
479
480
481def _has_child_file(directory: Path, file_name: str) -> bool:

Callers

nothing calls this directly

Calls 6

get_web_dirFunction · 0.90
notify_backendFunction · 0.85
should_use_granianFunction · 0.85
run_granian_backendFunction · 0.85
run_uvicorn_backendFunction · 0.85
existsMethod · 0.80

Tested by

no test coverage detected