Skip to content

Commit 8cb17b2

Browse files
committed
feat: remove dir_mode in get_flask_application
1 parent 18c89e3 commit 8cb17b2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

backend/funix/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,6 @@ def get_flask_application(
339339
file_or_module_name: str,
340340
no_frontend: Optional[bool] = False,
341341
lazy: Optional[bool] = False,
342-
dir_mode: Optional[bool] = False,
343342
package_mode: Optional[bool] = False,
344343
from_git: Optional[str] = None,
345344
repo_dir: Optional[str] = None,
@@ -358,7 +357,6 @@ def get_flask_application(
358357
file_or_module_name (str): The file or module name to run.
359358
no_frontend (bool): If you want to disable the frontend, default is False
360359
lazy (bool): If you want to enable lazy mode, default is False
361-
dir_mode (bool): If you want to enable dir mode, default is False
362360
package_mode (bool): If you want to enable package mode, default is False
363361
from_git (str): If you want to run the app from a git repo, default is None
364362
repo_dir (str): If you want to run the app from a git repo, you can specify the directory, default is None
@@ -384,6 +382,14 @@ def get_flask_application(
384382
if __host_regex:
385383
enable_funix_host_checker(__host_regex)
386384

385+
dir_mode = exists(file_or_module_name) and isdir(file_or_module_name)
386+
387+
if dir_mode and package_mode:
388+
print(
389+
'Error: Cannot use both directory mode and package mode.\nPlease run "funix --help" for more information.'
390+
)
391+
sys.exit(1)
392+
387393
import_from_config(
388394
file_or_module_name=file_or_module_name,
389395
lazy=lazy,

0 commit comments

Comments
 (0)