Skip to content

Commit 767c377

Browse files
committed
avoid validating app when running in backend only
1 parent 7ee3026 commit 767c377

1 file changed

Lines changed: 23 additions & 22 deletions

File tree

reflex/reflex.py

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -211,29 +211,30 @@ def _run(
211211

212212
prerequisites.check_latest_package_version(constants.Reflex.MODULE_NAME)
213213

214-
# Get the app module.
215-
app_task = prerequisites.compile_or_validate_app
216-
args = (frontend,)
217-
kwargs = {
218-
"check_if_schema_up_to_date": True,
219-
"prerender_routes": exec.should_prerender_routes(),
220-
}
221-
222-
# Granian fails if the app is already imported.
223-
if should_use_granian():
224-
import concurrent.futures
225-
226-
compile_future = concurrent.futures.ProcessPoolExecutor(max_workers=1).submit(
227-
app_task,
228-
*args,
229-
**kwargs,
230-
)
231-
return_result = compile_future.result()
232-
else:
233-
return_result = app_task(*args, **kwargs)
214+
if frontend:
215+
# Get the app module.
216+
app_task = prerequisites.compile_or_validate_app
217+
args = (frontend,)
218+
kwargs = {
219+
"check_if_schema_up_to_date": True,
220+
"prerender_routes": exec.should_prerender_routes(),
221+
}
222+
223+
# Granian fails if the app is already imported.
224+
if should_use_granian():
225+
import concurrent.futures
226+
227+
compile_future = concurrent.futures.ProcessPoolExecutor(max_workers=1).submit(
228+
app_task,
229+
*args,
230+
**kwargs,
231+
)
232+
return_result = compile_future.result()
233+
else:
234+
return_result = app_task(*args, **kwargs)
234235

235-
if not return_result:
236-
raise SystemExit(1)
236+
if not return_result:
237+
raise SystemExit(1)
237238

238239
if env != constants.Env.PROD and env != constants.Env.DEV:
239240
msg = f"Invalid env: {env}. Must be DEV or PROD."

0 commit comments

Comments
 (0)