|
1 |
| -import sys |
2 |
| -from pathlib import Path |
3 |
| - |
4 |
| -# Ensure the parent directory is in sys.path so relative imports work. |
5 |
| -base_dir = Path(__file__).parent |
6 |
| -if base_dir not in sys.path: |
7 |
| - sys.path.append(str(base_dir)) |
8 |
| -from backend.env import check_env |
9 |
| -from backend.paths import backend_dir, venv_dir |
10 |
| - |
11 |
| -if __name__ == "__main__": |
12 |
| - # Check if the environment is set up and activated before importing dependencies |
13 |
| - check_env() |
14 |
| - from starlette.staticfiles import StaticFiles |
15 |
| - |
16 |
| - # Create the app |
17 |
| - from app import create_app |
18 |
| - app = create_app() |
19 |
| - |
20 |
| - # Run the app |
21 |
| - import uvicorn |
22 |
| - uvicorn.run("app:create_app", host="localhost", port=3080, factory=True, workers=1, reload=True, reload_dirs=[backend_dir], reload_excludes=[venv_dir]) |
| 1 | +import sys |
| 2 | +from pathlib import Path |
| 3 | + |
| 4 | +# Ensure the parent directory is in sys.path so relative imports work. |
| 5 | +base_dir = Path(__file__).parent |
| 6 | +if base_dir not in sys.path: |
| 7 | + sys.path.append(str(base_dir)) |
| 8 | +from backend.env import check_env |
| 9 | +from backend.paths import backend_dir, venv_dir |
| 10 | + |
| 11 | +if __name__ == "__main__": |
| 12 | + # Check if the environment is set up and activated before importing dependencies |
| 13 | + check_env() |
| 14 | + from starlette.staticfiles import StaticFiles |
| 15 | + |
| 16 | + # Create the app |
| 17 | + from app import create_app |
| 18 | + app = create_app() |
| 19 | + |
| 20 | + # Run the app |
| 21 | + import uvicorn |
| 22 | + uvicorn.run("app:create_app", host="localhost", port=3080, factory=True, workers=1, reload=True, reload_dirs=[backend_dir], reload_excludes=[venv_dir]) |
0 commit comments