- startproject helloidol2
-
python -m pip install django~=4.2
-
django-admin startproject helloidol2
-
File > Settings... > Language & Frameworks > Django
[v] Enable Django Support
-
Run > Edit Configurations... > + > Django Server > Name: runserver
-
VCS > Enable Version Control Intergration... > git > ok
-
- startapp 여자친구
- python manage.py startapp 여자친구
- '여자친구', in INSTALLED_APPS in settings.py
- 여자친구/
- models
- Character
- name, feature, created_dt, updated_at
- photo
- Terminal
- python -m pip install pillow
- Terminal
__str__()
: 객체를 출력할 때, 알맞은 string으로 출력하자get_absolute_url()
: 캐릭터 하나 데이터 가져오자
- python manage.py makemigrations 여자친구
- python manage.py migrate
- Character
- admin
- Character
- python manage.py createsuperuser
- views
- R: CharacterListView
- R: CharacterDetailView
- C: CharacterCreateView
- add 'photo' in fields
- U: CharacterUpdateView
- add 'photo' in fields
- D: CharacterDeleteView
- templates/여자친구/
- character_list.html
- {{ character.photo.url }}
- character_detail.html
- {{ character.photo.url }}
- character_create.html
- enctype="multipart/form-data"
- character_update.html
- enctype="multipart/form-data"
- character_confirm_delete.html
- character_list.html
- urls
- 여자친구:character_list
- 여자친구: character_detail
- 여자친구: character_create
- 여자친구: character_update
- 여자친구: character_delete
- static/여자친구/
- photo/no_photo
- settings
- STATICFIELS_DIRS
- models
- helloidol2/
- urls
- MEDIA
- settings
- MEDIA_ROOT, MEDIA_URL
- urls
- templates/
- base.html
- settings.py > TEMPLATES
- 'DIRS': [BASE_DIR / 'templates']
- settings.py > TEMPLATES
- base.html