[파이썬 강의] REST APIs with Flask - SQL database
작성일: 23년 2월 10일
PS. 기존에 생성한 프로젝트에서 진행함. 이전 포스팅 확인 필요
https://louie0724.tistory.com/606
[파이썬 강의] REST APIs with Flask - Smorest
작성일: 23년 1월 30일 Contents 1. 프로젝트 구조 2. 저장된 데이터 확인 3. Store 포스트맨 4. Item 포스트맨 1. 프로젝트 구조 1) app.py - app.config[xxxx] = "xxxxx" 등과 같은 Flask의 Config 설정을 입력함 - resources
louie0724.tistory.com
Contents
1. Store
2. Item
3. 동작 확인(URL은 이전에 작성한 블로그와 동일함)
1. Store
1) models.store.py
- db.model을 상속받아서 데이터를 처리함
- item db와 관계가 되어 있는 것을 알 수 있음
2) resource.store.py
- model에서 정의한 내용을 바탕으로 db에서 데이터를 가져오거나 저장 할 수 있음
2. Item
1) model.item.py
- db.model을 상속받아서 데이터를 처리함
- store db의 id를 foreignkey로 사용 하고 있음을 알 수 있음
2) resource.item.py
3. 동작 확인(URL은 이전에 작성한 블로그와 동일함)
※ 여기서 ID는 Auto Increment를 사용함
1) Stores
- Post한 store 데이터를 Get 하여 데이터 확인
- stores 테이블에 저장된 데이터 확인
2) Items
- Post한 item데이터를 Get 하여 데이터 확인
- items의 테이블에 저장되니 데이터를 확인 할 수 있음
- store_id를 외래키로 가지고 있음을 알 수 있음
Referece:
https://rest-apis-flask.teclado.com/docs/first_rest_api/getting_set_up/
Getting set up | REST APIs with Flask and Python
Set up a Flask project and create the Flask app.
rest-apis-flask.teclado.com
https://github.com/tecladocode/rest-apis-flask-python
GitHub - tecladocode/rest-apis-flask-python: Projects and e-book for our course, REST APIs with Flask and Python
Projects and e-book for our course, REST APIs with Flask and Python - GitHub - tecladocode/rest-apis-flask-python: Projects and e-book for our course, REST APIs with Flask and Python
github.com
https://www.udemy.com/course/rest-api-flask-and-python/