File tree Expand file tree Collapse file tree 1 file changed +14
-18
lines changed Expand file tree Collapse file tree 1 file changed +14
-18
lines changed Original file line number Diff line number Diff line change 22
22
23
23
24
24
def get_default_path () -> Path :
25
- path = Path ("main.py" )
26
- if path .is_file ():
27
- return path
28
- path = Path ("app.py" )
29
- if path .is_file ():
30
- return path
31
- path = Path ("api.py" )
32
- if path .is_file ():
33
- return path
34
- path = Path ("app/main.py" )
35
- if path .is_file ():
36
- return path
37
- path = Path ("app/app.py" )
38
- if path .is_file ():
39
- return path
40
- path = Path ("app/api.py" )
41
- if path .is_file ():
42
- return path
25
+ potential_paths = (
26
+ "main.py" ,
27
+ "app.py" ,
28
+ "api.py" ,
29
+ "app/main.py" ,
30
+ "app/app.py" ,
31
+ "app/api.py" ,
32
+ )
33
+
34
+ for full_path in potential_paths :
35
+ path = Path (full_path )
36
+ if path .is_file ():
37
+ return path
38
+
43
39
raise FastAPICLIException (
44
40
"Could not find a default file to run, please provide an explicit path"
45
41
)
You can’t perform that action at this time.
0 commit comments