Update demo command to open demo.reflex.run (#2059)

This commit is contained in:
Nikhil Rao 2023-10-27 13:16:02 -07:00 committed by GitHub
parent 6b7bd8e51b
commit bb77d14fbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 15 deletions

View File

@ -7,6 +7,7 @@ import os
import shutil
import tempfile
import time
import webbrowser
from datetime import datetime
from pathlib import Path
from typing import List, Optional
@ -714,18 +715,22 @@ def demo(
backend_port: str = typer.Option("8001", help="Specify a different backend port."),
):
"""Run the demo app."""
with tempfile.TemporaryDirectory() as tmp_dir:
os.chdir(tmp_dir)
_init(
name="reflex_demo",
template=constants.Templates.Kind.DEMO,
loglevel=constants.LogLevel.ERROR,
)
_run(
frontend_port=frontend_port,
backend_port=backend_port,
loglevel=constants.LogLevel.ERROR,
)
# Open the demo app in a terminal.
webbrowser.open("https://demo.reflex.run")
# Later: open the demo app locally.
# with tempfile.TemporaryDirectory() as tmp_dir:
# os.chdir(tmp_dir)
# _init(
# name="reflex_demo",
# template=constants.Templates.Kind.DEMO,
# loglevel=constants.LogLevel.DEBUG,
# )
# _run(
# frontend_port=frontend_port,
# backend_port=backend_port,
# loglevel=constants.LogLevel.DEBUG,
# )
deployments_cli = typer.Typer()

View File

@ -878,9 +878,7 @@ def check_requirements_for_non_reflex_packages() -> bool:
return False
def authenticate_on_browser(
invitation_code: str,
) -> str:
def authenticate_on_browser(invitation_code: str) -> str:
"""Open the browser to authenticate the user.
Args: