
깃허브에서 conflict 해결하고 merge한 후에
git pull origin main 을 때렸는데.....
Auto-merging community/urls.py
CONFLICT (content): Merge conflict in community/urls.py
Auto-merging post/admin.py
CONFLICT (content): Merge conflict in post/admin.py
Auto-merging post/models.py
CONFLICT (content): Merge conflict in post/models.py
Auto-merging post/urls.py
CONFLICT (add/add): Merge conflict in post/urls.py
Auto-merging post/views.py
CONFLICT (content): Merge conflict in post/views.py
Automatic merge failed; fix conflicts and then commit the result.
온갖 conflict 가 생겼음.. 아무튼 잘 해결은 했으나 조금 어질하다..
git pull을 하면, 깃허브의 코드와 내 로컬의 코드의 merge가 이뤄지는 과정에서 많은 빨간 불이 있었던 것으로 추정...
post-list 보는 /post/에서 뜨는 작성하기 버튼을 누르면 post/create 페이지로 넘어가야하는 데 안 넘어가는 건
github 연동하고 pull해서 다른 팀원분이 구현하신 메인페이지에 나오는 post-list read를 하는 과정에 있어서,
Exception Type: MultiValueDictKeyError
Exception Value:
'title'
문제 원인!
post-list에 있는 글쓰기를 누르는 것 = request.method == GET => post/create.html을 띄우면 되는데,

Request method: POST
post/views.py 의 post_create 메소드 정의에서
title=request.POST["title"], 가 문제임.
root폴더/urls.py
urlpatterns = [ path('admin/', admin.site.urls), path( "", post_read, -> 여기를 TemplateView를 써서 post 데이터를 불러오지 못함 name="root", ), path('user/', include('user.urls')), path('post/', include('post.urls')), ]
post/templates/detail.html
1.
<img src="{{ post.image_url }}" />
2.
<img src="media/post_pics/{{post_image}}" />
3.
<img src="{{ post.image.url }}" />
4. <img src="/media/post_pics/{{ post.image }}" />
5. <img src="media/post_pics/{{ post_image }}/" />
드디어 해결 !!!!!!!!!!!
<img src="{{post.post_image.url}}" alt="" srcset="">
post_image라고 모델에서 정의를 했으면 그렇게 가져와야지.....
<post/views.py>
update 메소드
def post_update(request, post_id):
....
# 수정 전
post.post_image = request.Post["post_image"]
# 수정 후
post.post_image = request.FILES.get("post_image")
file-img, zip등 파일을 불러 올 때 장고에서는 request.FILE 하나면 된다.
request.FILE
ㄴ 모듈 ㄴ메소드
그리고 front-end에서 form 태그와 같은 거에 넣을 때 꼭 옵션으로enctype="multipart/form-data"
를 꼭 붙여줘야 한다.
새로운 브랜치 만들어서 merge 를 vscode로 진행하고
add -> commit -> 새로 만든 브랜치로 push
-> 드디어 merge완성...
내 두 시간.. 그 시간이었으면 댓글 구현 가능한데 ㅜㅜ 이런 철없는 생각