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

์ „์ฒด ๊ธ€77

[Django ์—๋Ÿฌ] Invalid template name in 'extends' tag: ''. Got this from the 'base.html' variable. ์›์ธ: {%extends 'base.html'%}๋กœ ์จ์•ผํ•˜๋Š”๋ฐ, ''๋ฅผ ์•ˆ์ผ๋‹ค.... ์˜คํƒ€, ์ฝค๋งˆ(,), ๋”ฐ์˜ดํ‘œ('')๋“ฑ๋“ฑ ํ•ญ์ƒ ์กฐ์‹ฌ.... 2020. 7. 16.
[Django note] #1 ๋‚ด๊ฐ€ ๋ณด๋ ค๊ณ  ๋งŒ๋“œ๋Š” ์žฅ๊ณ  ๋…ธํŠธ(static๊ณผ media) static 1. ์•ฑ ํด๋” ์•ˆ์— static ํด๋” ๋งŒ๋“ค๊ธฐ 2. settings.py์— staticํŒŒ์ผ์ด ์ง€๊ธˆ ์–ด๋””์— ์žˆ๋Š”์ง€, ์–ด๋””๋กœ ๋ชจ์„์ง€ ์•Œ๋ ค์ฃผ๊ธฐ #settings.py STATICFILES=[ os.path.join(BASE_DIR, '์•ฑ ์ด๋ฆ„', 'static') ] #ํ˜„์žฌ staticํŒŒ์ผ๋“ค์ด ์–ด๋””์— ์žˆ๋Š”์ง€ STATIC_ROOT=os.path.join(BASE_DIR, 'static') #static ํŒŒ์ผ์„ ์–ด๋””๋กœ ๋ชจ์„์ง€ 3. staticํŒŒ์ผ๋“ค์„ ๋ชจ์•„์ฃผ๊ธฐ ๋ช…๋ น์–ด: python manage.py collectstatic 4. html๋ฌธ์„œ์—์„œ static ํŒŒ์ผ ์‚ฌ์šฉํ•˜๊ธฐ ๋งจ ์œ„์— {%load static%} ์จ์ฃผ๊ธฐ #๊ถ๊ธˆํ•œ๊ฑฐ : ํ…œํ”Œ๋ฆฟ ํƒœ๊ทธ, ํ…œํ”Œ๋ฆฟ ๋ณ€์ˆ˜ ์ฐจ์ด์ ... Media *pip ํŒจํ‚ค์ง€ pillo.. 2020. 7. 14.
[Django ์—๋Ÿฌ] ์ž์ž˜ํ•œ ์—๋Ÿฌ ๋ชจ์Œ(๊ณ„์† ์ถ”๊ฐ€ ์˜ˆ์ •) ์˜คํƒ€, ๋ญ”๊ฐ€ ๋นผ๋จน์Œ ๋“ฑ์œผ๋กœ ์ธํ•œ ์ž์ž˜ํ•œ ์—๋Ÿฌ๋ฅผ ๋ชจ์•˜์Šต๋‹ˆ๋‹ค... #1. detail() got an unexpected keyword argument 'blog_id' ์›์ธ: detail ํ•จ์ˆ˜ ์ •์˜ํ•  ๋•Œ, ์ธ์ž๋กœ blog_id๋ฅผ ์•ˆ์คŒ views.py ์ˆ˜์ • ์ „ def detail(request): details=get_object_or_404(Blog, pk=blog_id) return render (request, 'detail.html', {'details':details})) ์ˆ˜์ • ํ›„ def detail(request, blog_id): details=get_object_or_404(Blog, pk=blog_id) return render (request, 'detail.html', {'details'.. 2020. 7. 13.
[Django ๊ฐœ๋…] model๊ณผ migrate model : ์žฅ๊ณ  ๊ฐ์ฒด ์ค‘ ํŠน๋ณ„ํ•œ ๊ฒƒ. ์ด ๊ฒƒ์„ ์ €์žฅํ•˜๋ฉด ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ์ €์žฅ๋œ๋‹ค. model์€ ์žฅ๊ณ ์˜ app์•ˆ์— ์ž๋™์œผ๋กœ ์ƒ์„ฑ๋˜๋Š” models.py์— ์ •์˜ํ•œ๋‹ค. model field type์˜ ์ข…๋ฅ˜ (1) CharField : ์ œํ•œ๋œ ๊ธธ์ด์˜ ๋ฌธ์ž์—ด ํ•„๋“œ ํƒ€์ž…. ๊ด„ํ˜ธ ์•ˆ์— max_length๋ฅผ ์ง€์ •ํ•ด ์ฃผ์–ด์•ผํ•œ๋‹ค. ex) title=models.CharField(max_length=200) ํŒŒ์ƒ ํ•„๋“œ๋“ค : EmailField(์ด๋ฉ”์ผ์ธ์ง€ ์ฒดํฌ), URLField(url์ธ์ง€ ์ฒดํฌ), GenericIPAddressField, GenericIPAdressField(IP์ธ์ง€ ์ฒดํฌ) ๋“ฑ๋“ฑ (2) TextField : ๋Œ€์šฉ๋Ÿ‰ ๋ฌธ์ž์—ด ํ•„๋“œ ex) body=models.TextField() (3) InterField : .. 2020. 7. 12.
[CSS3] ๊ตฌ์กฐ์  ๊ฐ€์ƒ ํด๋ž˜์Šค ์„ ํƒ์ž :root๋ฌธ์„œ์˜ ์ตœ์ƒ์œ„ ํƒœ๊ทธ(html)๋ฅผ ์„ ํƒํ•œ๋‹ค. ํƒœ๊ทธ:nth-child(n)n๋ฒˆ์งธ ํƒœ๊ทธ๊ฐ€ ์ผ์น˜ํ•˜๋ฉด ์„ ํƒํ•œ๋‹ค. (์—ฌ๊ธฐ์„œ n์€ ์ˆ˜์—ด์ด๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด 2n+1) ํƒœ๊ทธ:nth-last-child(n)๋’ค์—์„œ๋ถ€ํ„ฐ n๋ฒˆ์งธ ํƒœ๊ทธ๊ฐ€ ์ผ์น˜ํ•˜๋ฉด ์„ ํƒํ•œ๋‹ค. ํƒœ๊ทธ:nth-of-type(n)์ผ์น˜ํ•˜๋Š” ํƒœ๊ทธ๋“ค ์ค‘, n๋ฒˆ์งธ ํƒœ๊ทธ๋ฅผ ์„ ํƒํ•œ๋‹ค. ํƒœ๊ทธ:nth-last-of-type(n)์ผ์น˜ํ•˜๋Š” ํƒœ๊ทธ๋“ค ์ค‘, ๋’ค์—์„œ๋ถ€ํ„ฐ n๋ฒˆ์งธ ํƒœ๊ทธ๋ฅผ ์„ ํƒํ•œ๋‹ค. ํƒœ๊ทธ:first-chlid์ฒซ๋ฒˆ์งธ ํƒœ๊ทธ๊ฐ€ ์ผ์น˜ํ•˜๋ฉด ์„ ํƒํ•œ๋‹ค. ํƒœ๊ทธ:last-chlid๋งˆ์ง€๋ง‰ ํƒœ๊ทธ๊ฐ€ ์ผ์น˜ํ•˜๋ฉด ์„ ํƒํ•œ๋‹ค. ํƒœ๊ทธ:first-of-type์ผ์น˜ํ•˜๋Š” ํƒœ๊ทธ๋“ค ์ค‘, ์ฒซ๋ฒˆ์งธ ํƒœ๊ทธ๋ฅผ ์„ ํƒํ•œ๋‹ค. ํƒœ๊ทธ:last-of-type์ผ์น˜ํ•˜๋Š” ํƒœ๊ทธ๋“ค ์ค‘, ๋งˆ์ง€๋ง‰ ํƒœ๊ทธ๋ฅผ ์„ ํƒํ•œ๋‹ค. ํƒœ๊ทธ:only-child์ด ํƒœ๊ทธ๊ฐ€ .. 2020. 6. 28.