Tinkerbell Glitter
[241231] Classํ˜• View์™€ ํ•จ์ˆ˜ํ˜• View์˜ ์ฐจ์ด์ 
ยท
[๋‚ด๋ฐฐ์บ ] ๋ณธ ์บ ํ”„ (24.11.25 ~ 25.03.31) ๐Ÿƒ๐Ÿป‍โ™€๏ธ/Django ๐Ÿชข
ํ•จ์ˆ˜ ๊ธฐ๋ฐ˜ ๋ทฐ (Function-Based View, FBV) ๋ž€? โœจ1. ํ•จ์ˆ˜ํ˜• ๋ทฐ ์ •์˜FBV๋Š” Python์˜ ํ•จ์ˆ˜๋กœ ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ทฐ๋ฅผ ์ •์˜ํ•˜๋Š” ๋ฐฉ์‹์ด๋‹คํŠน์ง•๊ฐ„๋‹จํ•˜๊ณ  ์ง๊ด€์ : ๋‹จ์ˆœํ•œ ๋กœ์ง์„ ์ฒ˜๋ฆฌํ•  ๋•Œ ์ ํ•ฉํ•จ๋ช…์‹œ์  ์š”์ฒญ ์ฒ˜๋ฆฌ: ์š”์ฒญ ๋ฐฉ์‹(GET, POST ๋“ฑ)์„ ์กฐ๊ฑด๋ฌธ์œผ๋กœ ์ง์ ‘ ์ฒ˜๋ฆฌํ•œ๋‹ค์œ ์—ฐ์„ฑ: ๋‹จ์ˆœํ•œ ๊ตฌ์กฐ๋กœ ์‰ฝ๊ฒŒ ์ž‘์„ฑ ๊ฐ€๋Šฅfrom django.http import HttpResponsedef my_view(request): if request.method == 'GET': return HttpResponse("This is a GET request.") elif request.method == 'POST': return HttpResponse("This is a PO..
[241230] MVC ํŒจํ„ด๊ณผ MTV ํŒจํ„ด
ยท
[๋‚ด๋ฐฐ์บ ] ๋ณธ ์บ ํ”„ (24.11.25 ~ 25.03.31) ๐Ÿƒ๐Ÿป‍โ™€๏ธ/Django ๐Ÿชข
MVC ํŒจํ„ด์ด๋ž€?1. MVC ํŒจํ„ด์˜ ์ •์˜๋””์ž์ธ ํŒจํ„ด ์ค‘ ํ•˜๋‚˜๋กœ, ํ”„๋กœ์ ํŠธ์˜ ๊ตฌ์„ฑ ์š”์†Œ๋ฅผ ๋‹ค์Œ์— ๋”ฐ๋ผ ๊ตฌ๋ถ„ํ•˜๋Š” ํŒจํ„ด์ž„Model(๋ชจ๋ธ)๋ฐ์ดํ„ฐ์™€ ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง์„ ์ฒ˜๋ฆฌํ•จ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์™€ ์ƒํ˜ธ์ž‘์šฉ ๋ฐ ๋ฐ์ดํ„ฐ๋ฅผ ์ •์˜ํ•จView(๋ทฐ)์‚ฌ์šฉ์ž ์ธํ„ฐํŽ˜์ด์Šค(UI)๋ฅผ ๋‹ด๋‹นํ•จ์‚ฌ์šฉ์ž์—๊ฒŒ ๋ฐ์ดํ„ฐ๋ฅผ ๋ณด์—ฌ์ฃผ๋Š” ์—ญํ• ์ž„Controller(์ปจํŠธ๋กค๋Ÿฌ)์‚ฌ์šฉ์ž์˜ ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•จModel๊ณผ View๋ฅผ ์—ฐ๊ฒฐํ•˜๋Š” ์ค‘๊ฐ„ ์—ญํ• ์ž„ ๋””์ž์ธ ํŒจํ„ด์ด๋ž€?์†Œํ”„ํŠธ์›จ์–ด ๊ฐœ๋ฐœ์—์„œ ์ž์ฃผ ๋ฐœ์ƒํ•˜๋Š” ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด ๊ฒ€์ฆ๋œ ์žฌ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์„ค๊ณ„ ๋ฐฉ๋ฒ•์ฃผ๋กœ ๊ฐ์ฒด์ง€ํ–ฅ ํ”„๋กœ๊ทธ๋ž˜๋ฐ(OOP)์—์„œ ์‚ฌ์šฉ๋˜๋ฉฐ, ์„ค๊ณ„์˜ ํšจ์œจ์„ฑ์„ ๋†’์ด๊ณ  ์œ ์ง€๋ณด์ˆ˜๊ฐ€ ์šฉ์ดํ•˜๋‹คํ๋ฆ„์‚ฌ์šฉ์ž๊ฐ€ View๋ฅผ ํ†ตํ•ด ์š”์ฒญ์„ ๋ณด๋ƒ„Controller๊ฐ€ ์š”์ฒญ์„ ๋ฐ›๊ณ , ํ•„์š”ํ•œ ๋ฐ์ดํ„ฐ๋ฅผ Model์—์„œ ๊ฐ€์ ธ์˜ดController๊ฐ€ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€๊ณต..