FastAPI #01 - 기초

2024. 4. 11. 21:34Study/ETC

하드 코딩을 하지 않기 위해

로컬에서 사용할때는 .env 파일로,

클라우드 플랫폼인 Azure에서는 Azure CLI 등 보통 CLI 툴로 진행이 된다.

 

브라우저들은 기본적으로 cross-origin HTTP requests를 허용하지 않기 때문에,

CORS 설정을 올바르게 해야 정상적으로 작동, 그래도 FastAPI에서는 해당 설정이 쉬운 편

app.add_middleware(
    CORSMiddleware,
    allow_origins=["http://localhost:9000"],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"]
)

 

 

참고 자료 : https://dev-in-seoul.tistory.com/47

 

[FastAPI/Python] FastAPI 프로젝트 배포하기

Chapter 10: FastAPI 프로젝트 배포하기 이 단원에서는 FastAPI 프로젝트를 배포하는 Best Practice에 대해 배운다. 먼저 환경 변수를 사용해서 configuration을 진행하고, dependency들을 pip로 잘 관리될 수 있게

dev-in-seoul.tistory.com

 

 

 

실습 내역