Update dependencies and improve Python path handling
Updated several frontend dependencies including MUI packages and added new ones like `@mui/x-charts`. Adjusted the Python path setup in the CI configuration to correctly point to the `aaredb` backend, ensuring accurate module resolution.
This commit is contained in:
@ -1,11 +1,11 @@
|
|||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import tomllib
|
import tomllib
|
||||||
|
from contextlib import asynccontextmanager
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
from fastapi.staticfiles import StaticFiles
|
from fastapi.staticfiles import StaticFiles
|
||||||
from uvicorn import lifespan
|
|
||||||
|
|
||||||
from app import ssl_heidi
|
from app import ssl_heidi
|
||||||
from app.routers import (
|
from app.routers import (
|
||||||
@ -73,15 +73,6 @@ def run_server():
|
|||||||
|
|
||||||
# Get project metadata from pyproject.toml
|
# Get project metadata from pyproject.toml
|
||||||
project_name, project_version = get_project_metadata()
|
project_name, project_version = get_project_metadata()
|
||||||
app = FastAPI(
|
|
||||||
lifespan=lifespan,
|
|
||||||
title=project_name,
|
|
||||||
description="Backend for next-gen sample management system",
|
|
||||||
version=project_version,
|
|
||||||
servers=[
|
|
||||||
{"url": "https://mx-aare-test.psi.ch:1492", "description": "Default server"}
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
# Determine environment and configuration file path
|
# Determine environment and configuration file path
|
||||||
environment = os.getenv("ENVIRONMENT", "dev")
|
environment = os.getenv("ENVIRONMENT", "dev")
|
||||||
@ -121,18 +112,9 @@ if environment == "dev":
|
|||||||
if not Path(cert_path).exists() or not Path(key_path).exists():
|
if not Path(cert_path).exists() or not Path(key_path).exists():
|
||||||
ssl_heidi.generate_self_signed_cert(cert_path, key_path)
|
ssl_heidi.generate_self_signed_cert(cert_path, key_path)
|
||||||
|
|
||||||
# Apply CORS middleware
|
|
||||||
app.add_middleware(
|
|
||||||
CORSMiddleware,
|
|
||||||
allow_origins=["*"],
|
|
||||||
allow_credentials=True,
|
|
||||||
allow_methods=["*"],
|
|
||||||
allow_headers=["*"],
|
|
||||||
)
|
|
||||||
|
|
||||||
|
@asynccontextmanager
|
||||||
@app.on_event("startup")
|
async def lifespan(app: FastAPI):
|
||||||
def on_startup():
|
|
||||||
print("[INFO] Running application startup tasks...")
|
print("[INFO] Running application startup tasks...")
|
||||||
db = SessionLocal()
|
db = SessionLocal()
|
||||||
try:
|
try:
|
||||||
@ -180,10 +162,30 @@ def on_startup():
|
|||||||
from app.database import load_slots_data
|
from app.database import load_slots_data
|
||||||
|
|
||||||
load_slots_data(db)
|
load_slots_data(db)
|
||||||
|
|
||||||
|
yield
|
||||||
finally:
|
finally:
|
||||||
db.close()
|
db.close()
|
||||||
|
|
||||||
|
|
||||||
|
app = FastAPI(
|
||||||
|
lifespan=lifespan,
|
||||||
|
title=project_name,
|
||||||
|
description="Backend for next-gen sample management system",
|
||||||
|
version=project_version,
|
||||||
|
servers=[
|
||||||
|
{"url": "https://mx-aare-test.psi.ch:1492", "description": "Default server"}
|
||||||
|
],
|
||||||
|
)
|
||||||
|
# Apply CORS middleware
|
||||||
|
app.add_middleware(
|
||||||
|
CORSMiddleware,
|
||||||
|
allow_origins=["*"],
|
||||||
|
allow_credentials=True,
|
||||||
|
allow_methods=["*"],
|
||||||
|
allow_headers=["*"],
|
||||||
|
)
|
||||||
|
|
||||||
# Include routers with correct configuration
|
# Include routers with correct configuration
|
||||||
app.include_router(protected_router, prefix="/protected")
|
app.include_router(protected_router, prefix="/protected")
|
||||||
app.include_router(auth.router, prefix="/auth", tags=["auth"])
|
app.include_router(auth.router, prefix="/auth", tags=["auth"])
|
||||||
|
Reference in New Issue
Block a user