update-hugging
Browse files- src/api/main.py +9 -1
- src/config.py +1 -0
src/api/main.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
from contextlib import asynccontextmanager
|
| 2 |
from typing import AsyncGenerator
|
| 3 |
|
|
@@ -54,7 +55,14 @@ def create_app() -> FastAPI:
|
|
| 54 |
# Add CORS middleware
|
| 55 |
app.add_middleware(
|
| 56 |
CORSMiddleware,
|
| 57 |
-
allow_origins=[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
allow_credentials=True,
|
| 59 |
allow_methods=["*"],
|
| 60 |
allow_headers=["*"],
|
|
|
|
| 1 |
+
import os
|
| 2 |
from contextlib import asynccontextmanager
|
| 3 |
from typing import AsyncGenerator
|
| 4 |
|
|
|
|
| 55 |
# Add CORS middleware
|
| 56 |
app.add_middleware(
|
| 57 |
CORSMiddleware,
|
| 58 |
+
allow_origins=[
|
| 59 |
+
"https://frontend-hugging.vercel.app",
|
| 60 |
+
"https://frontend-hugging-myidyjvtn-asma-akbar-raos-projects.vercel.app", # Current Vercel deployment URL
|
| 61 |
+
"https://asmaakbar-phase-ll.hf.space", # Hugging Face Space URL
|
| 62 |
+
"http://localhost:3000", # For local development
|
| 63 |
+
"http://localhost:8000", # For local backend
|
| 64 |
+
settings.frontend_url, # Use configured frontend URL from settings
|
| 65 |
+
],
|
| 66 |
allow_credentials=True,
|
| 67 |
allow_methods=["*"],
|
| 68 |
allow_headers=["*"],
|
src/config.py
CHANGED
|
@@ -22,6 +22,7 @@ class Settings(BaseSettings):
|
|
| 22 |
app_name: str = "Todo Backend API"
|
| 23 |
debug: bool = os.getenv("DEBUG", "False").lower() == "true"
|
| 24 |
api_prefix: str = "/api"
|
|
|
|
| 25 |
|
| 26 |
class Config:
|
| 27 |
env_file = ".env"
|
|
|
|
| 22 |
app_name: str = "Todo Backend API"
|
| 23 |
debug: bool = os.getenv("DEBUG", "False").lower() == "true"
|
| 24 |
api_prefix: str = "/api"
|
| 25 |
+
frontend_url: str = os.getenv("FRONTEND_URL", "https://frontend-hugging.vercel.app")
|
| 26 |
|
| 27 |
class Config:
|
| 28 |
env_file = ".env"
|