Skip to content

Commit ff3343a

Browse files
authored
do not prematurely import app module if providing app_module_import (#5350)
* do not prematurely import app module if providing app_module_import * use .module
1 parent defca45 commit ff3343a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

reflex/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,8 +1006,8 @@ def module(self) -> str:
10061006
Returns:
10071007
The module name.
10081008
"""
1009-
if self.app_module is not None:
1010-
return self.app_module.__name__
1009+
if self.app_module_import is not None:
1010+
return self.app_module_import
10111011
return ".".join([self.app_name, self.app_name])
10121012

10131013
def update_from_env(self) -> dict[str, Any]:

reflex/utils/exec.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,9 @@ def get_reload_paths() -> Sequence[Path]:
300300
The reload paths for the backend.
301301
"""
302302
config = get_config()
303-
reload_paths = [Path(config.app_name).parent]
304-
if config.app_module is not None and config.app_module.__file__:
305-
module_path = Path(config.app_module.__file__).resolve().parent
303+
reload_paths = [Path.cwd()]
304+
if (spec := importlib.util.find_spec(config.module)) is not None and spec.origin:
305+
module_path = Path(spec.origin).resolve().parent
306306

307307
while module_path.parent.name and any(
308308
sibling_file.name == "__init__.py"

0 commit comments

Comments
 (0)