GithubHelp home page GithubHelp logo

fastapi-tutorial's Introduction

fastapi-tutorial

πŸ§™β€β™€οΈν˜Έμž‡μ¨”!πŸͺ„

개발 ν™˜κ²½

  • python version : 3.10^
  • fastapi : 0.1^

pyproject.toml 파일 참고

ν™˜κ²½ μ„ΈνŒ…

poetry μ‚¬μš©ν•˜μ—¬ ν”„λ‘œμ νŠΈ 관리

1. poetry μ„€μΉ˜

$ curl -sSL https://install.python-poetry.org | POETRY_HOME=/etc/poetry python3 -

2. peotryλ₯Ό μ΄μš©ν•˜μ—¬ κ°€μƒν™˜κ²½ μ‹€ν–‰

$ poetry shell

3. νŒ¨ν‚€μ§€ μ„€μΉ˜

$ poetry install

# 쒅속 μš”μ†Œ μ„€μΉ˜ μ‹œ --no-root ν”Œλž˜κ·Έ μΆ”κ°€
$ poetry install --no-root
파일ꡬ쑰 참고, Tutorial 파일 ꡬ쑰 ❌
my_fastapi_project/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ main.py
β”‚   β”œβ”€β”€ core/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ config.py
β”‚   β”‚   └── security.py
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ user.py
β”‚   β”‚   └── item.py
β”‚   β”œβ”€β”€ schemas/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ user.py
β”‚   β”‚   └── item.py
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ api_v1/
β”‚   β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”‚   β”œβ”€β”€ endpoints/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ users.py
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ items.py
β”‚   β”‚   β”‚   β”‚   └── login.py
β”‚   β”œβ”€β”€ crud/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ user.py
β”‚   β”‚   └── item.py
β”‚   β”œβ”€β”€ db/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ base.py
β”‚   β”‚   └── session.py
β”‚   β”œβ”€β”€ tests/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ test_user.py
β”‚   β”‚   └── test_item.py
β”‚   └── utils/
β”‚       β”œβ”€β”€ __init__.py
β”‚       └── utils.py
β”œβ”€β”€ alembic/
β”‚   β”œβ”€β”€ README
β”‚   β”œβ”€β”€ env.py
β”‚   β”œβ”€β”€ script.py.mako
β”‚   └── versions/
β”‚       └── <migration_files>
β”œβ”€β”€ .env
β”œβ”€β”€ .gitignore
β”œβ”€β”€ requirements.txt
└── README.md

Dependency Inhection (μ˜μ‘΄μ„± μ£Όμž…)

fastapiμ—μ„œ λ°μ΄ν„°λ² μ΄μŠ€λ₯Ό μ‚¬μš©ν•  λ•Œ db μ„Έμ…˜μ„ λ§Œλ“€κ³  μ‚¬μš©μ΄ μ’…λ£Œλ˜λ©΄ 이λ₯Ό λ°˜ν™˜ν•΄μ•Όν•œλ‹€. μ΄λŸ¬ν•œ 반볡적인 일을 μžλ™ν™”ν•  수 μžˆλŠ” 방법이 "μ˜μ‘΄μ„± μ£Όμž…" 이닀. ν•„μš”ν•œ κΈ°λŠ₯을 μ„ μ–Έν•˜μ—¬ μ‚¬μš©ν•  수 μžˆλ‹€λŠ” 의미.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.