반응형
Django Tutorial 도중 발생한 namespace Error가 있다.
이를 해결 하기 위한 방법이 있다.
Error Massge>
NoReverseMatch at
'polls" is not a registered namespace
Request Method:
Request URL:
Django Version:
Exception Type:
Exception Value:
'polls" is not a registered namespace
Exception Location:
Python Executable:
Python Version:
Python Path:
Server time:
Error during template rendering
In template , error at line 5
'polls" is not a registered namespace
Fix>
polls\urls.py 와 mysite\urls.py 를 수정한다.
'''
polls\urls.py
'''
from django.urls import path
from . import views
app_name = 'polls'
urlpatterns = [
path('', views.IndexView.as_view(), name='index'),
path('<int:pk>/', views.DetailView.as_view(), name='detail'),
path('<int:pk>/results/', views.ResultsView.as_view(), name='results'),
path('<int:question_id>/vote/', views.vote, name='vote'),
]
'''
mysite\urls.py
'''
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('polls/', include('polls.urls', namespace="polls")),
path('admin/', admin.site.urls),
]
반응형
'Python_WEB > Django_Tutorial' 카테고리의 다른 글
[Django]Survey WEB Application Tutorial 6 (0) | 2020.04.30 |
---|---|
[Django]Survey WEB Application Tutorial 5 (0) | 2020.04.30 |
[Django]Survey WEB Application Tutorial 4 (0) | 2020.04.29 |
[Django]Survey WEB Application Tutorial 3 (0) | 2020.04.29 |
[Django]Survey WEB Application Tutorial 2 (0) | 2020.04.29 |