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

๋ฐ˜์‘ํ˜•

๐Ÿ’ป Deep Wide Programming/Django

(12)
[โ›บ๏ธํด๋ก ์ฝ”๋”ฉ] django Creating the Apps/ Models django Creating the Apps (๋ฒ„๋ธ” ์•ˆ์—์„œ)django-admin startapp ์•ฑ์ด๋ฆ„ django-admin startapp rooms๋ฅผ ์ž…๋ ฅํ–ˆ๋”๋‹ˆ, rooms๋ผ๋Š” ํด๋”๊ฐ€ ์ƒ์„ฑ๋˜์—ˆ๋Š”๋ฐ ์•ˆ์— ์—ฌ๋Ÿฌ๊ฐ€์ง€ ์ค€๋น„๋ฌผ๋“ค์ด ์ด๋ฏธ ์ฑ™๊ฒจ์ ธ ์žˆ๋‹ค.(์ด๋•Œ ์ƒ์„ฑ๋œ ํŒŒ์ผ ๋ช…๋“ค์„ ์ž„์˜๋กœ ๋ฐ”๊พธ๋ฉด ์•ˆ๋œ๋‹ค. library๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹Œ, framework๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด๊ธฐ ๋•Œ๋ฌธ!!โ—๏ธframework = ์ •ํ•ด์ง„ ๋ฃฐ๋Œ€๋กœ ์‚ฌ์šฉํ•ด์•ผ ํ•œ๋‹ค. โ—๏ธlibrary = ๋ญ”๊ฐ€๋ฅผ ์ง“๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ•œ๋‹ค. ex. react ) ๊ณ„ํšํ•œ ์žฅ๊ณ  app์— ํ•„์š”ํ•œ ํ•˜์œ„ app ํด๋”๋“ค์„ ์ƒ์„ฑํ•ด์ค€๋‹ค.๊ทธ๋ฆฌ๊ณ  ๊ฐ๊ฐ์˜ ํด๋”์— urls.py ํŒŒ์ผ์„ ์ƒ์„ฑํ•ด์ค€๋‹ค. ์‚ฌ์šฉํ•˜๊ฒŒ๋  url์ด ๊ต‰์žฅํžˆ ๋งŽ์„ ๊ฑฐ๊ธฐ ๋•Œ๋ฌธ์—, configํด๋”์˜ url ํŒŒ์ผ์—์„œ๊ฐ€ ์•„๋‹ˆ๋ผ, ..
[โ›บ๏ธํด๋ก ์ฝ”๋”ฉ] ์žฅ๊ณ  ์„œ๋ฒ„ ์‹คํ–‰ํ•˜๊ธฐ, ์žฅ๊ณ  App ๊ธฐํš ์žฅ๊ณ  ์„œ๋ฒ„ ์‹คํ–‰ํ•˜๊ธฐ terminal์—์„œ ๋ฒ„๋ธ”์ด ์žˆ๋Š” ์ž‘์—…ํด๋”์— ๋“ค์–ด๊ฐ„ ๋’ค, ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ฝ”๋“œ๋ฅผ ์ž…๋ ฅํ•œ๋‹ค. ๐Ÿ‘ฉ‍๐Ÿ’ป pipenv shell python manage.py runserver ๊ทธ๋Ÿฌ๋ฉด ์žฅ๊ณ ๊ฐ€ ์ฃผ๋Š” ๋งํฌ๊ฐ€ ํ•˜๋‚˜ ๋œจ๋Š”๋ฐ, ํด๋ฆญํ•˜๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์€ ํ™”๋ฉด์˜ ์›นํŽ˜์ด์ง€๋ฅผ ๋ณผ ์ˆ˜ ์žˆ๋‹ค. http://127.0.0.1:8000/ ์„œ๋ฒ„๋ฅผ ๊ตฌ๋™์‹œํ‚จ ๊ฒƒ์ด๋‹ค! ์„œ๋ฒ„ ์ฃผ์†Œ์— /admin์„ ์ถ”๊ฐ€ํ•ด์„œ ๊ฒ€์ƒ‰ํ•ด๋ณด๋ฉด, ์–ด๋“œ๋ฏผ ํŽ˜์ด์ง€๋„ ๋งŒ๋“ค์–ด์ ธ ์žˆ๋Š”๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค. (๋กœ๊ทธ์ธํ•˜๋ผ๊ณ  ๋œธ) \ [๋งŒ์•ฝ ์˜ค๋ฅ˜๊ฐ€ ๋œฌ๋‹ค๋ฉด] ์„œ๋ฒ„ ๋„๋Š” ๋ฒ•: ํ„ฐ๋ฏธ๋„> ctrl + z (์œ„ ์„œ๋ฒ„ ํŽ˜์ด์ง€ ๋ฆฌํ”„๋ ˆ์‹œ ํ•˜๋ฉด ๊ตฌ๋™ ์•ˆํ•˜๋Š” ๊ฒƒ์œผ๋กœ ํ™•์ธ ๊ฐ€๋Šฅ) ์„œ๋ฒ„๋ฅผ ๋ˆ ์ƒํƒœ์—์„œ, ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ž…๋ ฅ python manage.py migrate python manage.py ..
[ํด๋ก ์ฝ”๋”ฉโ›บ๏ธ] #2 INTRODUCTION TO DJANGO ๐Ÿ“ŒCreating a Django Project ์ด์–ด์„œ, ๊ฐ™์€ ํŒŒ์ผ/๊ฐœ๋ฐœํ™˜๊ฒฝ ๋‚ด์—์„œ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ž…๋ ฅ django-admin startproject config django-admin startproject config . (๋์— .์„ ๋ถ™์ด๋ฉด ์•„๋ž˜์™€ ๊ฐ™์€ ์ ˆ์ฐจ ํ•˜์ง€ ์•Š์•„๋„ ๋˜๋Š”๋“ฏ.,?) ๊ทธ๋Ÿฌ๋ฉด ์œ„์™€ ๊ฐ™์€ ํŒŒ์ผ๋“ค์ด ์ƒ์„ฑ๋œ๋‹ค. ํด๋”๋ช…์„ ๋ณ€๊ฒฝํ•ด์ค€๋‹ค. ๊ทธ๋ฆฌ๊ณ  ๊ทธ ์•ˆ์— ๋“ค์–ด์žˆ๋˜ configํด๋”์™€ manage.py๋ฅผ ๋ฐ–์œผ๋กœ ๊บผ๋‚ธ๋‹ค. ๊ทธ๋ฆฌ๊ณ ๋‚˜์„œ Aconfig ํด๋”๋Š” ์ง€์šด๋‹ค. ํ•˜๋‹จ์—์„œ ๋ฒ„์ „์ด pipenv๊ฐ€ ํฌํ•จ๋œ ๋ฒ„์ „์ธ์ง€ ํ™•์ธํ•˜๊ณ  ๋ณ€๊ฒฝํ•ด์ค€๋‹ค. ๐Ÿ“ŒSetting up VSCode and Python Like a PRO Linting Python in Visual Studio Code Linting Python in Vis..
[โ›บ๏ธํด๋ก ์ฝ”๋”ฉ] pipenv, Django ์„ค์น˜, ๊ฐœ๋ฐœํ™˜๊ฒฝ ๊ตฌ์ถ•ํ•˜๊ธฐ ๐Ÿ“Œ์•ž์œผ๋กœ ์‚ฌ์šฉํ•  Framework ๐Ÿ‘‰django : Prevent "reinventing the wheel" ๐Ÿ‘‰tailwindcss(utility first css framework) ๐Ÿ“Œpipenv ์„ค์น˜ pipenv : ์žฅ๊ณ  ์„ค์น˜ ์‹œ, pipenv๋กœ ์„ค์น˜ํ•  ๊ฒƒ. pipenv๋ฅผ ์ด์šฉํ•˜๋ฉด, ๋ฒ„๋ธ”์„ installํ•ด์ค€๋‹ค. global๋กœ ๋‹ค์šด๋˜์ง€ ์•Š๊ณ , ๋ฒ„๋ธ”์— ๋ฒ„์ „๋ณ„๋กœ ๋‹ค์šด๋กœ๋“œ ๊ฐ€๋Šฅ ๐Ÿ‘‰Mac OS/๋ฆฌ๋ˆ…์Šค๋ผ๋ฉด brew install pipenv ๋ฅผ ์ด์šฉํ•ด ๋‹ค์šด๋กœ๋“œ! brew install pipenv ๐Ÿ‘จ‍๐Ÿ’ป brew๊ฐ€ ๊น”๋ ค์žˆ์ง€ ์•Š๋‹ค๋ฉด, ๋‹ค์Œ์˜ ๋ช…๋ น์–ด๋กœ home brew์„ค์น˜ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/instal..

728x90
๋ฐ˜์‘ํ˜•