Deploy the app to the Reflex hosting service.
(
app_name: str | None,
app_id: str | None,
region: tuple[str, ...],
env: tuple[str],
vmtype: str | None,
hostname: str | None,
interactive: bool,
envfile: str | None,
project: str | None,
project_name: str | None,
token: str | None,
config_path: str | None,
backend_excluded_dirs: tuple[Path, ...] = (),
ssr: bool = True,
)
| 832 | help="Whether to enable server side rendering for the frontend.", |
| 833 | ) |
| 834 | def deploy( |
| 835 | app_name: str | None, |
| 836 | app_id: str | None, |
| 837 | region: tuple[str, ...], |
| 838 | env: tuple[str], |
| 839 | vmtype: str | None, |
| 840 | hostname: str | None, |
| 841 | interactive: bool, |
| 842 | envfile: str | None, |
| 843 | project: str | None, |
| 844 | project_name: str | None, |
| 845 | token: str | None, |
| 846 | config_path: str | None, |
| 847 | backend_excluded_dirs: tuple[Path, ...] = (), |
| 848 | ssr: bool = True, |
| 849 | ): |
| 850 | """Deploy the app to the Reflex hosting service.""" |
| 851 | from reflex_cli.utils import dependency |
| 852 | from reflex_cli.v2 import cli as hosting_cli |
| 853 | from reflex_cli.v2.deployments import check_version |
| 854 | |
| 855 | from reflex.utils import export as export_utils |
| 856 | from reflex.utils import prerequisites |
| 857 | |
| 858 | config = get_config() |
| 859 | |
| 860 | app_name = app_name or config.app_name |
| 861 | |
| 862 | check_version() |
| 863 | |
| 864 | environment.REFLEX_COMPILE_CONTEXT.set(constants.CompileContext.DEPLOY) |
| 865 | |
| 866 | if not environment.REFLEX_SSR.is_set(): |
| 867 | environment.REFLEX_SSR.set(ssr) |
| 868 | elif environment.REFLEX_SSR.get() != ssr: |
| 869 | ssr = environment.REFLEX_SSR.get() |
| 870 | |
| 871 | # Only check requirements if interactive. |
| 872 | # There is user interaction for requirements update. |
| 873 | if interactive: |
| 874 | dependency.check_requirements() |
| 875 | |
| 876 | prerequisites.assert_in_reflex_dir() |
| 877 | |
| 878 | # Check if we are set up. |
| 879 | if prerequisites.needs_reinit(): |
| 880 | _init(name=config.app_name) |
| 881 | prerequisites.check_latest_package_version(constants.ReflexHostingCLI.MODULE_NAME) |
| 882 | |
| 883 | hosting_cli.deploy( |
| 884 | app_name=app_name, |
| 885 | app_id=app_id, |
| 886 | export_fn=( |
| 887 | lambda zip_dest_dir, api_url, deploy_url, frontend, backend, upload_db, zipping: ( |
| 888 | export_utils.export( |
| 889 | zip_dest_dir=zip_dest_dir, |
| 890 | api_url=api_url, |
| 891 | deploy_url=deploy_url, |
nothing calls this directly
no test coverage detected