python - Page not found in Django -
i'm following this tutorial learn django. i'm total starter. urls.py file has following code
from django.conf.urls import include, url django.contrib import admin . import views urlpatterns = [ url(r'^$', views.index, name='index'), url(r'^polls/', include('polls.urls')), url(r'^admin/', include(admin.site.urls)), ]
my views.py file is
from django.shortcuts import render def index(request): return httpresponse("hello, world. you're @ polls index.")
when try access th url http://127.0.0.1:8000/polls/ in system gives page not found message. doing wrong? problem version difference?
here screenshot of error
this error comes if urls.py file in polls directory not have pattern. create file urls.py polls directory , add following url pattern
from django.conf.urls import patterns, url polls import views urlpatterns = patterns('', # ex: /polls/ url(r'^$', views.index, name='index'), )
Comments
Post a Comment