Notice
Recent Posts
Recent Comments
ยซ   2024/11   ยป
์ผ ์›” ํ™” ์ˆ˜ ๋ชฉ ๊ธˆ ํ† 
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Tags more
Archives
Today
Total
๊ด€๋ฆฌ ๋ฉ”๋‰ด

๐ŸŒฒ์ž๋ผ๋‚˜๋Š”์ฒญ๋…„

[์žฅ๊ณ ] ์ฒซ๋ฒˆ์งธ ์žฅ๊ณ  ์•ฑ ์ž‘์„ฑํ•˜๊ธฐ 2-1(๊ด€๋ฆฌ์ž ์„œ๋ฒ„) ๋ณธ๋ฌธ

django

[์žฅ๊ณ ] ์ฒซ๋ฒˆ์งธ ์žฅ๊ณ  ์•ฑ ์ž‘์„ฑํ•˜๊ธฐ 2-1(๊ด€๋ฆฌ์ž ์„œ๋ฒ„)

JihyunLee 2019. 9. 17. 15:55
๋ฐ˜์‘ํ˜•

https://docs.djangoproject.com/ko/2.2/intro/tutorial02/

 

์ฒซ ๋ฒˆ์งธ ์žฅ๊ณ  ์•ฑ ์ž‘์„ฑํ•˜๊ธฐ, part 2 | Django ๋ฌธ์„œ | Django

Django The web framework for perfectionists with deadlines. Overview Download Documentation News Community Code Issues About ♥ Donate

docs.djangoproject.com

(ํŠœํ† ๋ฆฌ์–ผ ์ƒ ์•ž ๋‚ด์šฉ์ธ Api๊ฐ€์ง€๊ณ  ๋†€๊ธฐ๋Š” ๊ทธ๋ƒฅ ๋”ฐ๋ผํ•˜๋ฉด ๋˜๋Š” ๊ฒƒ์ด๋ผ์„œ ์ƒ๋žต!)

 

 ์žฅ๊ณ ๋Š” ์ด์ „์— ์จ๋ณธ node.js์™€ ๋‹ค๋ฅด๊ฒŒ ๊ด€๋ฆฌ์ž์šฉ ํŽ˜์ด์ง€๊ฐ€ ์ œ๊ณต์ด ๋˜์—ˆ๋‹ค. ์ด ๊ด€๋ฆฌ์ž์šฉ ํŽ˜์ด์ง€๋ฅผ ํ†ตํ•ด์„œ database๋ฅผ ๊ด€๋ฆฌ ํ•  ์ˆ˜ ์žˆ์—ˆ๋‹ค.

 

1. ๊ด€๋ฆฌ์ž ์ƒ์„ฑํ•˜๊ธฐ

1
$ python manage.py createsuperuser
cs

๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•˜๋ฉด ๊ด€๋ฆฌ์ž ๊ณ„์ •์„ ์ƒ์„ฑํ•˜๊ฒŒ ๋œ๋‹ค.

 

2. ๊ฐœ๋ฐœ ์„œ๋ฒ„ ์‹œ์ž‘

1
$ python manage.py runserver
cs

 

์„œ๋ฒ„๋ฅผ ์‹œ์ž‘ํ•˜๊ณ , http://127.0.0.1:8000/admin/ ์ฃผ์†Œ์ฐฝ์— ์ž…๋ ฅํ•˜๋ฉด ๊ด€๋ฆฌ์ž ํŽ˜์ด์ง€๋กœ ๋“ค์–ด๊ฐˆ ์ˆ˜ ์žˆ๋‹ค. ์ฒ˜์Œ์—๋Š” polls์˜ ๋ฐ์ดํ„ฐ ๋ฒ ์ด์Šค๋ฅผ ์ˆ˜์ • ํ•  ๊ถŒํ•œ์ด ์—†๋Š”๋ฐ ์•„๋ž˜ ์ฝ”๋“œ๋ฅผ ์ž…๋ ฅํ•˜๋ฉด polls๋ฅผ ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋œ๋‹ค.

 

1
2
3
4
5
6
7
from django.contrib import admin
 
from .models import Question
from .models import Choice
 
admin.site.register(Question)
admin.site.register(Choice)
cs

 

 

 

 

๋ฐ˜์‘ํ˜•