Code Monkey home page Code Monkey logo

study-fastapi's Introduction

FastAPI Study

좋아요(star), 구독(follow), 알람 설정(watch)까지.

0. 차림판


1. FastAPI 스터디


2. Boilerplate

이 저장소와 projects/hello-graphql 디렉터리가 Boilerplate 구축을 위한 것.

Boilerplate 구성

  • pyproject.toml 기반으로 Python Project 구성
  • monorepo 느낌나게 패키지 분리
    • projects : 프로젝트
    • contrib : 각 프로젝트에서 사용하는 공통 패키지
  • poetry로 패키지 관리
  • Makefile로 주요 명령어 관리
    • 프로젝트 단위로 관리하므로 프로젝트 디렉터리에 존재

프로젝트 구성

  • 각 프로젝트는 projects 디렉터리 안에 위치하며, 프로젝트 이름과 동일한 디렉터리에는 해당 프로젝트의 시스템 설정 파일이 위치.
  • 각 프르젝트를 구성하는 주요 단위는 앱(app)이며, projects/<프로젝트>/apps에 위치.
    • projects/hello_graphql/apps/hellohello_graphql 프로젝트의 hello 앱을 의미.

Scripts

projects/hello_graphql/Makefile 파일을 기반은 명령어들.

패키지 관련

  • make package-install : Poetry 패키지 설치
  • make package-update : Poetry 패키지 업데이트
  • make package-show : Poetry 패키지 목록 보기

실행 관련

  • make runserver : local 서버 실행. (http://127.0.0.1:8899)
  • make shell : Poetry 패키지 의존 관계를 반영하여 Python shell 실행 (virtualenv처럼)

테스트 관련

  • make test-apps : apps의 모든 테스트 수행.
  • make test-apps/hello : hello app의 테스트만 수행.
  • make cov-apps : apps의 모든 테스트 수행. (coverage 검사 포함)
  • make cov-apps/hello : hello app의 테스트만 수행. (coverage 검사 포함)

Lint 관련

  • make lint-check : Black을 이용해 Lint 검사 수행.
  • make lint-reformat : Black을 이용해 Lint 검사하고 재구성(reformatting) 수행.

Poetry 관련

  • make config-venv : Poetry virtualenv configuration 반영.

Server Application Settings

hello_graphql/settings.py

구동 환경 별로 settings 를 구성하려면 이 모듈에 작업.

  • LocalAppSettings, TestAppSettings : local, test 환경에 사용할 settings.
  • EnvName : 환경 이름.
  • environments : EnvName*AppSettings를 짝지어놓은 객체.

dot env files

*AppSettings는 dot env 파일을 참조하여 설정을 override 함. *AppSettings.Config.env_file 참조.

Editor

참조

study-fastapi's People

Contributors

hannal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.