본문 바로가기

Programming/Django46

[Django] 📘 Template Language (DTL) — 중요한 개념 3가지 1. ✅ 딕셔너리 접근 방식: [] ❌ → . ✅Django 템플릿에서는 파이썬 딕셔너리처럼 ['key']로 접근할 수 없습니다.❌ 일반적인 파이썬 방식 (사용 불가){{ my_dict['title'] }}✅ DTL 방식 (dot notation){{ my_dict.title }}왜?DTL은 파이썬이 아니라 Django가 만든 템플릿 전용 언어이기 때문입니다.dot notation은 딕셔너리 키, 객체의 속성, 모델의 필드 모두를 유연하게 처리합니다.2. ✅ 함수 호출도 괄호 없이 사용Django 템플릿에서는 함수를 호출하지 않습니다. 즉, ()를 붙이지 않아요.❌ 파이썬 함수 호출{{ my_function() }}✅ DTL 방식 (함수 결과를 context에서 전달받은 변수처럼 사용){{ my_func.. 2025. 7. 18.
[Python Django - The Practical Guide] Urls & Views https://www.udemy.com/course/python-django-the-practical-guide/?srsltid=AfmBOooIsUYcHXcq98H0RVFtBtC6ORNnGCSAvH7KEQBZfff3KPfPwNBk본 내용은 해당 강의 내용을 참조하여 만들었음을 밝힙니다.What are "URLs" (or "Routes")?어떤 url을 만들건지 고려해야 한다. 다양한 url을 가지고 있고 각기 다른 응답을 가진다. What are Views?The logic that is executed for different URLs (and Http methods)장고 프로젝트에서 뷰는 가장 간단하게 function이라고 생각하면 된다. 특정한 url이 장고 서버에 전달이 되었을 때 작동하는 fun.. 2025. 7. 17.
[Python Django - The Practical Guide] Course Setup https://www.udemy.com/course/python-django-the-practical-guide/?srsltid=AfmBOooIsUYcHXcq98H0RVFtBtC6ORNnGCSAvH7KEQBZfff3KPfPwNBk본 내용은 해당 강의 내용을 참조하여 만들었음을 밝힙니다.asgi.py & wsgi.py -> related to serving our python Django Applicationmanage.py -> 딱히 바꿀 일 없음. urls.py 와 settings.py를 많이 바꾸게 됨. ❯ python manage.py runserverWatching for file changes with StatReloaderPerforming system checks...System check .. 2025. 7. 16.
[Python Django - The Practical Guide] Getting Started https://www.udemy.com/course/python-django-the-practical-guide/?srsltid=AfmBOooIsUYcHXcq98H0RVFtBtC6ORNnGCSAvH7KEQBZfff3KPfPwNBk본 내용은 해당 강의 내용을 참조하여 만들었음을 밝힙니다.What is Django?Django is Python web developemt framework* Built for Python 3.x -> Build for the latest version of Python* Batteris Included -> Offers build-in solutions and features for basically all probloms, Customizable & extensible* B.. 2025. 7. 16.