diff --git a/.gitignore b/.gitignore index 20a2c14..f15d4b7 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,4 @@ run paramkey.txt *.log __pycache__/ -src .env diff --git a/python/fastapi/src/__init__.py b/python/fastapi/src/__init__.py new file mode 100755 index 0000000..e69de29 diff --git a/python/fastapi/src/utils.py b/python/fastapi/src/utils.py new file mode 100755 index 0000000..9cc62ef --- /dev/null +++ b/python/fastapi/src/utils.py @@ -0,0 +1,17 @@ +from pathlib import Path +import os + + +def get_project_dir(): + return Path(__file__).parent.parent + +def get_pid(): + return os.getpid() + +def check_path(paths: list): + for path in paths: + if os.path.exists(path) is False: + os.mkdir(path) + +def target_url(domain, path): + return f"{domain}/{path}" diff --git a/python/fastapi_demo/src/__init__.py b/python/fastapi_demo/src/__init__.py new file mode 100755 index 0000000..e69de29 diff --git a/python/fastapi_demo/src/utils.py b/python/fastapi_demo/src/utils.py new file mode 100755 index 0000000..9cc62ef --- /dev/null +++ b/python/fastapi_demo/src/utils.py @@ -0,0 +1,17 @@ +from pathlib import Path +import os + + +def get_project_dir(): + return Path(__file__).parent.parent + +def get_pid(): + return os.getpid() + +def check_path(paths: list): + for path in paths: + if os.path.exists(path) is False: + os.mkdir(path) + +def target_url(domain, path): + return f"{domain}/{path}"