Use demo app for reflex demo command (#2048)

This commit is contained in:
Nikhil Rao 2023-10-26 21:49:00 -07:00 committed by GitHub
parent f5e9debe4f
commit 804f55dbf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -123,7 +123,7 @@ def init(
def _run(
env: constants.Env,
env: constants.Env = constants.Env.DEV,
frontend: bool = True,
backend: bool = True,
frontend_port: str = str(get_config().frontend_port),
@ -165,6 +165,9 @@ def _run(
if backend_port != str(config.backend_port):
config._set_persistent(backend_port=backend_port)
# Reload the config to make sure the env vars are persistent.
get_config(reload=True)
console.rule("[bold]Starting Reflex App")
if frontend:
@ -711,17 +714,13 @@ def demo(
os.chdir(tmp_dir)
_init(
name="reflex_demo",
template=constants.Templates.Kind.BASE,
loglevel=constants.LogLevel.ERROR,
template=constants.Templates.Kind.DEMO,
loglevel=constants.LogLevel.DEBUG,
)
_run(
env=constants.Env.DEV,
frontend=True,
backend=True,
frontend_port=frontend_port,
backend_port=backend_port,
backend_host="localhost",
loglevel=constants.LogLevel.ERROR,
loglevel=constants.LogLevel.DEBUG,
)