(dev mode) start backend without waiting for page compilation (#2549)
* start backend without waiting for page compilation * remove prints for measuring time saved * pin tighter on uvicorn
This commit is contained in:
parent
7fb9747fa7
commit
a4c8c72177
1023
poetry.lock
generated
1023
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@ -40,10 +40,7 @@ redis = "^4.3.5"
|
|||||||
rich = "^13.0.0"
|
rich = "^13.0.0"
|
||||||
sqlmodel = "^0.0.14"
|
sqlmodel = "^0.0.14"
|
||||||
typer = ">=0.4.2,<1"
|
typer = ">=0.4.2,<1"
|
||||||
uvicorn = [
|
uvicorn = "^0.27.0"
|
||||||
{version = "^0.24.0", python = ">=3.12"},
|
|
||||||
{version = "^0.20.0", python = "<3.12"},
|
|
||||||
]
|
|
||||||
watchdog = "^2.3.1"
|
watchdog = "^2.3.1"
|
||||||
watchfiles = "^0.19.0"
|
watchfiles = "^0.19.0"
|
||||||
starlette-admin = "^0.9.0"
|
starlette-admin = "^0.9.0"
|
||||||
|
@ -1,13 +1,21 @@
|
|||||||
"""Shims the real reflex app module for running backend server (uvicorn or gunicorn).
|
"""Shims the real reflex app module for running backend server (uvicorn or gunicorn).
|
||||||
Only the app attribute is explicitly exposed.
|
Only the app attribute is explicitly exposed.
|
||||||
"""
|
"""
|
||||||
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
|
|
||||||
from reflex import constants
|
from reflex import constants
|
||||||
from reflex.utils.prerequisites import get_compiled_app
|
from reflex.utils.prerequisites import get_app, get_compiled_app
|
||||||
|
|
||||||
if "app" != constants.CompileVars.APP:
|
if "app" != constants.CompileVars.APP:
|
||||||
raise AssertionError("unexpected variable name for 'app'")
|
raise AssertionError("unexpected variable name for 'app'")
|
||||||
app = getattr(get_compiled_app(), constants.CompileVars.APP)
|
|
||||||
|
app_module = get_app(reload=False)
|
||||||
|
app = getattr(app_module, constants.CompileVars.APP)
|
||||||
|
ThreadPoolExecutor(max_workers=1).submit(app.compile_)
|
||||||
|
|
||||||
# ensure only "app" is exposed.
|
# ensure only "app" is exposed.
|
||||||
|
del app_module
|
||||||
|
del get_app
|
||||||
del get_compiled_app
|
del get_compiled_app
|
||||||
del constants
|
del constants
|
||||||
|
del ThreadPoolExecutor
|
||||||
|
Loading…
Reference in New Issue
Block a user