리뷰 등록 구현하기 4:26 url 오류
347
投稿した質問数 4
안녕하세요.
4:25 에서 list.html 파일 안에서 url 경로를 강의 똑같이,
<a href="{% url 'restaurant-detail' id=item.id %}" class="card-link">자세히 보기</a>
이렇게 똑같이 수정했는데도 여전히 리스트 화면을 불러오지 못하고 수정전과 같은 에러가 뜨네요.
NoReverseMatch at /third/list/
Reverse for 'restaurant-detail' with no arguments not found. 1 pattern(s) tried: ['third\\/restaurant\\/(?P<id>[0-9]+)\\/\\Z']
回答 1
0
문제를 해결했는데, 혹시 같은 문제를 겪으실 분들도 계실 거 같아 댓글 남깁니다.
강사님이 urls.py 파일에서
path('detail/', views.detail, name='restaurant-detail')
이 부분을 지우시고,
path('restaurant/<int:id>/', views.detail, name='restaurant-detail')
이렇게 경로를 대체 하셨는데,
둘다 필요합니다.
즉, 4:30 기점으로 url.py 파일은 이렇게 되어야 합니다.
from django.urls import path
from . import views
urlpatterns = [
path('list/', views.list, name='list'),
path('create/', views.create, name='restaurant-create'),
path('update/', views.update, name='restaurant-update'),
path('detail/', views.detail, name='restaurant-detail'),
path('delete/', views.delete, name='restaurant-delete'),
path('restaurant/<int:id>/', views.detail, name='restaurant-detail'), # detail 의 주소를 재정의
]
빨간 줄이 뜨네요
0
137
1
import 문장에 빨간줄이 뜹니다.
0
156
1
putty 관련 질문
0
192
1
uWSGI 세팅하기_ 최종 502 bad gateway error
0
809
1
putty 접속관련
0
305
1
[리뷰 삭제하기] 삭제시 path 에러문구나옴.
0
386
1
데이터 새성시 forms.py, models.py 관련문의
0
308
1
'폼으로 데이터 전송하기' 강의 소리가 갑자기 작아짐
0
318
1
[스태틱]index.html 의 이미지를 변경하려면 ?
0
508
1
WARNINGS: ?: (staticfiles.W004) The directory 'C:\projects\first-django\static' in the STATICFILES_DIRS setting does not exist.
0
427
1
사진 넣고 엑박...ㅜㅜ
0
335
0
간단한 웹 페이지 띄우기 강의 10분 후반쯤
0
419
0
create.html
0
361
1
502 badgateway 오류가 떠요
0
284
0
putty에서 막혔네요 ㅠㅠ
0
355
2
django) 한 폼에 여러 모델 데이터 입력하는 경우
0
328
0
파이참 안에서 가상환경 접속이 안 됩니다.
0
691
1
settings.py
0
305
1
만약 웹앱을 업데이트할경우는 어떻게 해야하나요?
0
374
1
CSS 가운데 정렬 적용 안됨
0
4833
3
NameError: name 'os' is not defined
2
1107
1
1분 26초에 post=Post.objects.create(title="this is title", content="this is content")부분이 실행이 안됩니다.
0
267
1
virtualenv가 설치가 안됩니다..
0
439
1
자꾸 에러가뜹니다
0
746
1

