mirror of
https://github.com/Cccc-owo/CheckInApp.git
synced 2026-06-17 05:56:29 +00:00
refactor(structure): reorganize app layout
BREAKING CHANGE: root backend/frontend directories and old run/manage entrypoints were removed. Use apps/backend, apps/frontend, and python main.py commands instead.
This commit is contained in:
+7
-4
@@ -47,10 +47,13 @@ logs/
|
||||
Thumbs.db
|
||||
|
||||
# 前端
|
||||
frontend/node_modules/
|
||||
frontend/dist/
|
||||
frontend/.vite/
|
||||
apps/frontend/node_modules/
|
||||
apps/frontend/dist/
|
||||
apps/frontend/.vite/
|
||||
apps/new-frontend/node_modules/
|
||||
apps/new-frontend/dist/
|
||||
apps/new-frontend/.vite/
|
||||
|
||||
.claude
|
||||
.codex
|
||||
openspec
|
||||
openspec
|
||||
|
||||
@@ -37,16 +37,16 @@
|
||||
python -m venv venv
|
||||
venv\Scripts\activate # Windows
|
||||
source venv/bin/activate # Linux/Mac
|
||||
pip install -r backend/requirements.txt
|
||||
python3 run.py
|
||||
pip install -r apps/backend/requirements.txt
|
||||
python main.py backend
|
||||
|
||||
# 前端
|
||||
cd frontend
|
||||
cd apps/frontend
|
||||
npm install
|
||||
npm run dev
|
||||
|
||||
# 创建管理员
|
||||
python backend/scripts/create_admin.py
|
||||
PYTHONPATH=apps python apps/backend/scripts/create_admin.py
|
||||
```
|
||||
|
||||
### 访问地址
|
||||
@@ -57,15 +57,11 @@ python backend/scripts/create_admin.py
|
||||
## 进程管理
|
||||
|
||||
```bash
|
||||
# Windows
|
||||
manage.bat start [all/backend/fronted]
|
||||
manage.bat stop [all/backend/fronted]
|
||||
manage.bat status
|
||||
|
||||
# Linux/Mac
|
||||
./manage.sh start [all/backend/fronted]
|
||||
./manage.sh stop [all/backend/fronted]
|
||||
./manage.sh status
|
||||
python main.py backend-daemon
|
||||
python main.py frontend-daemon
|
||||
python main.py status
|
||||
python main.py stop [all|backend|frontend]
|
||||
python main.py frontend-build
|
||||
```
|
||||
|
||||
## 配置
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
from typing import List
|
||||
|
||||
# 项目根目录
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
BASE_DIR = Path(__file__).resolve().parents[2]
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
@@ -167,9 +167,10 @@ app.include_router(templates.router, prefix=f"{settings.API_PREFIX}/templates",
|
||||
if __name__ == "__main__":
|
||||
import uvicorn
|
||||
uvicorn.run(
|
||||
"main:app",
|
||||
"backend.main:app",
|
||||
host="0.0.0.0",
|
||||
port=8000,
|
||||
reload=True,
|
||||
reload_dirs=[str(settings.BASE_DIR / "apps" / "backend")],
|
||||
log_level="info",
|
||||
)
|
||||
@@ -3,18 +3,16 @@
|
||||
创建管理员用户的脚本
|
||||
|
||||
使用方法:
|
||||
python backend/scripts/create_admin.py
|
||||
PYTHONPATH=apps python apps/backend/scripts/create_admin.py
|
||||
|
||||
或使用虚拟环境:
|
||||
./venv/Scripts/python.exe backend/scripts/create_admin.py
|
||||
PYTHONPATH=apps ./venv/bin/python apps/backend/scripts/create_admin.py
|
||||
"""
|
||||
import sys
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
# 添加项目根目录到路径
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
||||
sys.path.insert(0, str(BASE_DIR))
|
||||
APPS_DIR = Path(__file__).resolve().parents[2]
|
||||
sys.path.insert(0, str(APPS_DIR))
|
||||
|
||||
from backend.models import init_db, User
|
||||
from backend.models.database import SessionLocal
|
||||
+3
-3
@@ -7,15 +7,15 @@
|
||||
- last_failed_login: 最后一次登录失败时间
|
||||
|
||||
运行方式:
|
||||
PYTHONPATH=apps python -m backend.scripts.migrate_add_account_lockout
|
||||
python -m backend.scripts.migrate_add_account_lockout
|
||||
"""
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# 添加项目根目录到 Python 路径
|
||||
project_root = Path(__file__).resolve().parent.parent.parent
|
||||
sys.path.insert(0, str(project_root))
|
||||
APPS_DIR = Path(__file__).resolve().parents[2]
|
||||
sys.path.insert(0, str(APPS_DIR))
|
||||
|
||||
from sqlalchemy import text
|
||||
from backend.models.database import engine
|
||||
@@ -2,7 +2,10 @@
|
||||
测试新的异常处理系统
|
||||
"""
|
||||
import sys
|
||||
sys.path.insert(0, '..')
|
||||
from pathlib import Path
|
||||
|
||||
APPS_DIR = Path(__file__).resolve().parents[2]
|
||||
sys.path.insert(0, str(APPS_DIR))
|
||||
|
||||
from backend.exceptions import (
|
||||
ValidationError,
|
||||
@@ -94,7 +97,7 @@ def check_old_exception_patterns():
|
||||
for pattern_name, pattern in patterns.items():
|
||||
results[pattern_name] = []
|
||||
|
||||
for root, dirs, files in os.walk('../backend/api'):
|
||||
for root, dirs, files in os.walk(APPS_DIR / 'backend' / 'api'):
|
||||
for file in files:
|
||||
if file.endswith('.py'):
|
||||
filepath = os.path.join(root, file)
|
||||
|
Before Width: | Height: | Size: 650 B After Width: | Height: | Size: 650 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 496 B After Width: | Height: | Size: 496 B |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user