35 lines
796 B
Python
35 lines
796 B
Python
import requests
|
|
import os
|
|
from fastapi import FastAPI
|
|
from fastapi.staticfiles import StaticFiles
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
import logging
|
|
|
|
logging.basicConfig(
|
|
level=logging.INFO,
|
|
format="%(asctime)s %(levelname)s %(filename)s:%(lineno)d %(funcName)s %(message)s",
|
|
)
|
|
logger = logging.getLogger(__name__)
|
|
origins = [
|
|
"http://localhost",
|
|
"http://localhost:4173",
|
|
"http://localhost:5173",
|
|
"http://localhost:8000",
|
|
]
|
|
|
|
|
|
api_app = FastAPI(title="api app")
|
|
|
|
app = FastAPI(title="main app")
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=origins,
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
app.mount("/api", api_app)
|
|
app.mount("/", StaticFiles(directory="front/.output/public", html=True), name="front")
|