콘텐츠로 이동

문제 해결

각 섹션은 화면에 나타나는 메시지를 먼저 보여 주고, 이어서 원인과 해결 방법을 설명합니다.

fastkit: command not found

$ fastkit --version
bash: fastkit: command not found

셸이 fastkit 명령을 찾지 못하는 상황입니다. fastkit을 설치한 가상 환경이 활성화되어 있지 않거나, uv tool install이 명령을 설치하는 폴더가 PATH에 들어 있지 않기 때문입니다(uv tool update-shell을 실행하면 추가됩니다). 가상 환경을 활성화하세요(source .venv/bin/activate, Windows에서는 .venv\Scripts\activate). 그러면 fastkit --version이 fastapi-fastkit, version 2.0.0을 출력합니다. python -m fastapi_fastkit은 활성화된 가상 환경의 Python으로 같은 명령을 실행합니다. 자세한 내용은 설치를 참고하세요.

프로젝트가 이미 있을 때

$ fastkit init --name hello --no-venv -y
╭──────────────── Error ────────────────╮
│ ❌ Project 'hello' already exists.    │
╰───────────────────────────────────────╯

init은 따로 요청하지 않는 한 이미 있는 폴더에 파일을 쓰지 않습니다. 보통은 다른 이름을 쓰면 해결됩니다. 아래의 다른 두 방법을 시도하기 전에는 작업 내용을 커밋하거나 백업해 두세요.

  • fastkit deleteproject hello는 확인을 받은 뒤 hello 폴더 전체를 삭제합니다.
  • --in-place는 현재 폴더에 프로젝트를 작성합니다. 템플릿에 없는 파일은 그대로 두고, 템플릿에 있는 파일(README.md 등)은 덮어씁니다. 터미널에서는 덮어쓸 파일을 나열하고 먼저 확인을 요청하며, -y를 지정하면 묻지 않고 덮어씁니다.

템플릿이 없을 때

$ fastkit init --template fastapi-sqlmode --project-name notes
╭───────────────────────────────── Error ──────────────────────────────────╮
│ ❌ Template 'fastapi-sqlmode' does not exist. Did you mean               │
│ 'fastapi-sqlmodel', 'fastapi-single-module'? Run 'fastkit                │
│ list-templates' to see the available templates.                          │
╰──────────────────────────────────────────────────────────────────────────╯

fastkit 2.0에서 제거된 템플릿도 같은 방식으로 알려 줍니다. 제거된 템플릿을 대신할 방법은 fastkit 1.x에서 업그레이드하기에 나와 있습니다.

runserver가 가상 환경을 찾지 못할 때

--no-venv로 만들었거나 새로 클론한 프로젝트에는 .venv가 없습니다. 이때 fastkit runserver는 프로젝트의 패키지 관리자로 가상 환경을 만드는 명령을 출력합니다. 그 명령을 실행한 다음 fastkit runserver를 다시 실행하세요.

$ fastkit runserver
╭───────────────────────────────── Error ──────────────────────────────────╮
│ ❌ This FastAPI-fastkit project has no virtual environment (.venv), for  │
│ example because it was created with --no-venv. Create it and install the │
│ dependencies from the project directory with:                            │
│   uv sync                                                                │
│ then run 'fastkit runserver' again.                                      │
╰──────────────────────────────────────────────────────────────────────────╯
Do you want to continue with the current Python instead? [y/N]: n

uv가 설치되어 있지 않을 때

fastkit은 uv가 설치되어 있으면 uv를, 그렇지 않으면 pip을 사용합니다. pip을 사용하면 요약 표의 Package manager 행에 pip (uv is not installed)가 표시되고, Next steps 패널과 README.md에도 pip 명령이 나옵니다. 프로젝트는 pip으로도 문제없이 동작합니다. uv를 사용하려면 uv를 설치한 뒤 프로젝트를 다시 만들거나, --package-manager를 지정하세요.

Poetry 버전이 2.0보다 낮을 때

$ fastkit init --name shop --level layered --database None --package-manager poetry -y
...
╭───────────────────────────────── Error ──────────────────────────────────╮
│ ❌ Project creation failed: Poetry 1.7.1 is installed, but projects      │
│ generated by FastAPI-fastkit need Poetry 2.0 or later (they keep their   │
│ dependencies in the standard [project] table, which older Poetry cannot  │
│ read). Upgrade Poetry with 'poetry self update' (or 'pipx upgrade        │
│ poetry' if pipx installed it), or choose another package manager with    │
│ --package-manager uv, pdm or pip. Nothing was created.                   │
╰──────────────────────────────────────────────────────────────────────────╯

포트가 이미 사용 중일 때

다른 프로세스가 이미 그 포트를 사용하고 있는 상황입니다. 이전에 띄운 서버인 경우가 많습니다. runserver는 서버의 종료 상태를 그대로 사용해 종료합니다.

$ fastkit runserver
...
╭───────────────────── Success ──────────────────────╮
│ ✨ Starting FastAPI server at 127.0.0.1:8000...    │
╰────────────────────────────────────────────────────╯
...
ERROR:    [Errno 48] Address already in use
╭───────────────────────────────── Error ──────────────────────────────────╮
│ ❌ The FastAPI server stopped with exit status 3; its messages above say │
│ why.                                                                     │
╰──────────────────────────────────────────────────────────────────────────╯

다른 서버를 중지하거나, --port로 비어 있는 포트를 지정하세요. 오류 번호는 시스템마다 다릅니다.

프로젝트 이름이 의존성 이름과 같을 때

$ fastkit init --template fastapi-sqlmodel --project-name sqlmodel --no-venv
╭───────────────────────────────── Error ──────────────────────────────────╮
│ ❌ The project name 'sqlmodel' is also the name of one of its            │
│ dependencies (sqlmodel>=0.0.42): the package manager would take the      │
│ project for that package and not install it, so the app could not import │
│ it. Choose another project name.                                         │
╰──────────────────────────────────────────────────────────────────────────╯

Windows

  • 가상 환경을 활성화할 때는 source .venv/bin/activate 대신 .venv\Scripts\activate를 사용하세요.
  • fastkit runserver는 모든 운영 체제에서 개발 서버를 시작합니다. 다만 생성된 프로젝트에 들어 있는 scripts/*.sh 도우미 스크립트를 실행하려면 Git Bash나 WSL이 필요합니다.