django_study(1-1)

mseo39ยท2021๋…„ 1์›” 4์ผ
2

django

๋ชฉ๋ก ๋ณด๊ธฐ
1/7
post-thumbnail

๐Ÿฆ7๊ธฐ ๋ฉ‹์‚ฌ django๊ฐ•์˜ ํ•„๊ธฐ๐Ÿฆ

Django ๊ธฐ์ดˆ

1. ๊ธฐ๋ณธํ™˜๊ฒฝ setting

๊ฐ€์ƒํ™˜๊ฒฝ์ด๋ž€?

๋‚ด๊ฐ€ ์ง„ํ–‰ํ•  ํ”„๋กœ์ ํŠธ๋ฅผ ๋‹ด์„ ๋…๋ฆฝ๋œ ๊ณต๊ฐ„
๊ฐ๊ฐ ๋…๋ฆฝ๋œ ๊ณต๊ฐ„์œผ๋กœ ํ”„๋กœ์ ํŠธ ๊ด€๋ฆฌ ๊ฐ€๋Šฅ

๐Ÿ‘‰"์šฐ๋ฆฌ๋Š” ๊ฐ€์ƒํ™˜๊ฒฝ์„ ๋งŒ๋“ค์–ด์ฃผ๊ณ  ์—ฌ๊ธฐ์— ํ”„๋กœ์ ํŠธ๋ฅผ ๋‹ด์„ ์˜ˆ์ •์ด๋‹ค!"

๋ณธ๊ฒฉ์ ์œผ๋กœ ๊ธฐ๋ณธํ™˜๊ฒฝ ์„ธํŒ…ํ•˜๊ธฐ

  1. ์ž์‹ ์ด ์›ํ•˜๋Š” ๊ณณ์— ํด๋”๋ฅผ ๋งŒ๋“ค๊ณ  vs code์— ๋งŒ๋“  ํด๋”๋ฅผ ๋ถˆ๋Ÿฌ์˜ด

  2. ์ƒˆ ํ„ฐ๋ฏธ๋„ ํด๋ฆญ(bash๋กœ ์„ค์ •)
    (1) ctrl + shift + p
    ->select default shell ์ž…๋ ฅ
    ->git bash ํด๋ฆญ
    (2)ํด๋” ์•ˆ์—์„œ git bash here + code..

    ๐Ÿ‘‰"3๋‹จ๊ณ„ ์ „์— ํŒŒ์ด์ฌ์ด ์ œ๋Œ€๋กœ ์„ค์น˜๋˜์–ด์žˆ๋Š”์ง€ ํ™•์ธํ•ด๋ณด์ž"

    ํ™•์ธํ•  ์ˆ˜ ์žˆ๋Š” ๋ช…๋ น์–ด: python --version

  3. ๊ฐ€์ƒํ™˜๊ฒฝ ์ƒ์„ฑ (์ž์‹ ์ด ์›ํ•˜๋Š” ๋ฐฉ๋ฒ•์œผ๋กœ ์ƒ์„ฑ _์•„๋‚˜์ฝ˜๋‹ค ๋“ฑ)

    python -m venv <๊ฐ€์ƒํ™˜๊ฒฝ ์ด๋ฆ„>

    ๐Ÿ‘‰<๊ฐ€์ƒํ™˜๊ฒฝ ์ด๋ฆ„>์œผ๋กœ ํด๋”๊ฐ€ ์ƒ์„ฑ๋จ

  4. ๊ฐ€์ƒํ™˜๊ฒฝ ์‹คํ–‰

    source <๊ฐ€์ƒํ™˜๊ฒฝ ์ด๋ฆ„>/scripts/activate

    -๊ฐ€์ƒํ™˜๊ฒฝ ์ข…๋ฃŒ๋Š” deactivate

  5. django๋ฅผ ์„ค์น˜ํ•˜์ž

    ๐Ÿ‘‰๊ฐ€์ƒํ™˜๊ฒฝ์„ ์‹คํ–‰ํ•œ ์ƒํƒœ์—์„œ django๋ฅผ ์„ค์น˜!

    -django ์„ค์น˜ํ•˜๋Š” ๋ช…๋ น์–ด

    pip intall django

    -django ์ง€์šฐ๋Š” ๋ช…๋ น์–ด

    pip uninstall django

    -ํŠน์ • ๋ฒ„์ „๋งŒ ์„ค์น˜ํ•˜๋Š” ๋ช…๋ น์–ด

    pip install django==(๋ฒ„์ „ ์ด๋ฆ„)

    ๐Ÿ‘‰ pip๋ž€?
    -๋ชจ๋“ˆ์ด๋‚˜ ํŒจํ‚ค์ง€๋ฅผ ์‰ฝ๊ฒŒ ์„ค์น˜ํ•  ์ˆ˜ ์žˆ๋„๋ก ๋„์™€์ฃผ๋Š” ๋„๊ตฌ

  6. django ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ

    django-admin startproject (ํ”„๋กœ์ ํŠธ๋ช…)
    ์„œ๋ฒ„ ์‹คํ–‰ : python manage.py runserver

์—…๋กœ๋“œ์ค‘..

  1. ์•ฑ ์ƒ์„ฑ

    python manage.py startapp (์•ฑ๋ช…)

  1. ํ”„๋กœ์ ํŠธ์— ์•ฑ์ด ์ƒ์„ฑ๋˜์—ˆ์Œ์„ ์•Œ๋ฆฌ๊ธฐ

    '(์•ฑ๋ช…).apps.(์•ฑ๋ช… ์ฒซ๊ธ€์ž๋งŒ ๋Œ€๋ฌธ์ž)Config',


์•ฑ ํด๋” ์•ˆ์— ์žˆ๋Š” apps.py ํŒŒ์ผ์—์„œ ๊ฐ€์ ธ์˜จ ๊ฒƒ

profile
ํ•˜๋ฃจํ•˜๋ฃจ ์„ฑ์‹คํ•˜๊ฒŒ

0๊ฐœ์˜ ๋Œ“๊ธ€