FastAPI(1)

권도현·2025년 10월 13일

FastAPI 개발일지#1

  • app/__init__.py생성
from fastapi import FastAPI
from fastapi.responses import ORJSONResponse


app=FastAPI(
    default_response_class=ORJSONResponse
)
  • asgi.py생성
from app import app


if __name__=="__main__":
    import uvicorn
    
    uvicorn.run(app,host="0.0.0.0",port=8000)

orjson install

poetry add orjson==3.10.12
https://github.com/ijl/orjson
orjson은 python 내장 json라이브러리보다 훨씬 빠른 속도로 (역)직렬화를 해주는 라이브러리이다.
FastAPI squeeze

router 생성

app/dtos/frozen_config.py

from pydantic import ConfigDict

FROZEN_CONFIG=ConfigDict(frozen=True)
profile
weeeeeeeee!

0개의 댓글