๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐Ÿ Python4

Django ๋ทฐ์—์„œ 'me'๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ์ฟผ๋ฆฌ ํŒŒ๋ผ๋ฏธํ„ฐ ์ฒ˜๋ฆฌ (๋ฐฉ์‹ ์ฐจ์ด) ์žฅ๊ณ ์—์„œ GET LIST ์š”์ฒญ์—์„œ ?user=me ์ฒ˜๋ฆฌํ•˜๋Š” ๋ฐฉ์‹๊ณผ GET DETAIL ์š”์ฒญ์—์„œ pk ๋Œ€์‹  me๋ฅผ ์ž…๋ ฅํ•˜๋Š” ๋ฐฉ์‹์ด ์–ด๋–ป๊ฒŒ ๋‹ค๋ฅธ๊ฐ€์— ๋Œ€ํ•ด์„œ ์ด์•ผ๊ธฐํ•ด๋ณด๋ ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค. GET LIST ์š”์ฒญ์—์„œ /v1/push/?user=me ์ฒ˜๋ฆฌํ•˜๊ธฐ ๋ชฉ๋ก ์—”๋“œํฌ์ธํŠธ์—์„œ๋Š” user=me๊ฐ€ ์ฟผ๋ฆฌ ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ์ „๋‹ฌ๋  ๋•Œํ˜„์žฌ ์‚ฌ์šฉ์ž์™€ ๊ด€๋ จ๋œ ๊ฐ์ฒด(์—ฌ๊ธฐ์„œ๋Š” push ์ธ์Šคํ„ด์Šค)๋งŒ ํฌํ•จํ•˜๋„๋ก ์ฟผ๋ฆฌ์…‹์„ ํ•„ํ„ฐ๋งํ•˜๋Š” ๊ฒƒ์ด ๋ชฉํ‘œ์ž…๋‹ˆ๋‹ค.class PushFilter(django_filters.FilterSet): user = django_filters.CharFilter(method="user_filter") def user_filter(self, queryset, name, value): if value: .. 2024. 12. 5.
[Python/ERROR] Circular import (Runtime๊ณผ Import Time์˜ ์ฐจ์ด์ ) ์—๋Ÿฌ๋ฉ”์‹œ์ง€ ImportError: cannot import name 'db' from partially initialized module 'app' (most likely due to a circular import) ํ•ด๋‹น ์—๋Ÿฌ๋Š” ๋ชจ๋“ˆ ๊ฐ„์— ์„œ๋กœ๋ฅผ "์ƒํ˜ธ ์ฐธ์กฐ"ํ•  ๋•Œ ๋ฐœ์ƒํ•œ๋‹ค. ์ƒˆ๋กœ์šด ๋ชจ๋“ˆ์„ import ํ•ด์ค„ ๋•Œ ๊ผฌ์ด๋ฉด ํ•ด๋‹น ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค. ๋‚˜์˜ ๊ฒฝ์šฐ Flask ํ”„๋ ˆ์ž„์›Œํฌ๋ฅผ ์ด์šฉํ•ด์„œ ์•„๋ž˜์™€ ๊ฐ™์€ ํด๋” ๊ตฌ์กฐ๋กœ ๊ฐœ๋ฐœํ•˜๋‹ค๊ฐ€ ์œ„์˜ ์—๋Ÿฌ๋ฅผ ๋งŒ๋‚˜๊ฒŒ ๋˜์—ˆ๋‹ค. (์•„๋ž˜ ํด๋”๊ตฌ์กฐ๋Š” ๋‹จ์ˆœํ™”ํ•œ ๊ฒƒ์ž„) app/ โ”œโ”€โ”€ __init__.py โ”œโ”€โ”€ models.py โ”œโ”€โ”€ routers.py โ”œโ”€โ”€ config.py โ””โ”€โ”€ run.py app.py 1. __init__.py์™€ models.py์™€ app.py ํŒŒ์ผ์„ ๊ฐ๊ฐ ์ž์„ธํžˆ.. 2023. 4. 24.
[TIL] FastAPI tutorial (based documentation) ์ฐธ๊ณ ํ•œ ๊ณต์‹ ๋ฌธ์„œ(tutorial): https://fastapi.tiangolo.com/tutorial ์ฐธ๊ณ ํ•œ ๊ณต์‹ ๋ฌธ์„œ(advanced): https://fastapi.tiangolo.com/advanced ์ฐธ๊ณ ํ•œ fastapi BLOG: https://lucky516.tistory.com/97 ์Šค๊ฐฑ์˜ ๊นƒํ—ˆ๋ธŒ ๋งํฌ: https://github.com/mathtkang/fastapi-tutorial ์ž‘์„ฑํ•œ ๋…ธ์…˜ํŽ˜์ด์ง€: https://sprinkle-piccolo-9fc.notion.site/TIL-FastAPI-tutorial-13052523e8ae48ad8b3e1c66ce859aa9 TIL (FastAPI tutorial) from fastapi import FastAPI app = FastAPI().. 2023. 3. 6.
[TIL] Django tutorial (based documentation) ์ฐธ๊ณ ํ•œ ๊ณต์‹ ๋ฌธ์„œ: https://docs.djangoproject.com/ko/4.1 ์Šค๊ฐฑ์˜ ๊นƒํ—ˆ๋ธŒ ๋งํฌ: https://github.com/mathtkang/django-tutorial ์ž‘์„ฑํ•œ ๋…ธ์…˜ํŽ˜์ด์ง€: https://sprinkle-piccolo-9fc.notion.site/TIL-Django-tutorial-eb8fec3e3f2a4592b880dbda311f9749 TIL (Django tutorial) docs tutorial์„ ๋ณด๋ฉด์„œ, ๋‚ด๊ฐ€ ์ƒˆ๋กญ๊ฒŒ ์•Œ๊ฒŒ๋œ ๊ฒƒ ์œ„์ฃผ๋กœ ์ •๋ฆฌํ•ฉ๋‹ˆ๋‹ค. + ์›ํ•˜๋Š”๋Œ€๋กœ ์ปค์Šคํ…€ ํ•ด๋ณด๊ธฐ! https://docs.djangoproject.com/ko/4.1 sprinkle-piccolo-9fc.notion.site 2023. 3. 6.