-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
37 lines (32 loc) · 1 KB
/
main.py
File metadata and controls
37 lines (32 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from app import __version__
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.staticfiles import StaticFiles
from fastapi.responses import FileResponse
import os
from app.api.routes import router
app = FastAPI(
title="I",
description="Production-ready Python with FastAPI and tsvector",
version=__version__,
)
# CORS middleware for development
app.add_middleware(
CORSMiddleware,
allow_origins=[
"http://localhost:1999",
"https://goldlabel.pro",
"https://soho.goldlabel.pro",
],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"]
)
app.include_router(router)
# Mount static directory
app.mount("/static", StaticFiles(directory=os.path.join(os.path.dirname(__file__), "static")), name="static")
# Favicon route
@app.get("/favicon.ico", include_in_schema=False)
async def favicon():
favicon_path = os.path.join(os.path.dirname(__file__), "static", "favicon.ico")
return FileResponse(favicon_path)