1
votes

i am new to django and web frameworks. As said in the documentation of django 1.11.4, i changed polls/view.py as

from django.http import HttpResponse


def index(request):
    return HttpResponse("Hello, world. You're at the polls index.")

after that i created polls/urls.py and write code in it as:

from django.conf.urls import url
from . import views


urlpatterns = [
    url(r'^$', views.index, name='index'),
]

finally changed mysite/urls.py as

from django.conf.urls import include, url
from django.contrib import admin

urlpatterns = [
    url(r'^polls/', include('polls.urls')),
    url(r'^admin/', admin.site.urls),
    ]

when i run this project with: python manage.py runserver

it shows error when go to "http://localhost:8000/polls/":

Not Found: /polls/
[09/Aug/2017 12:01:36] "GET /polls/ HTTP/1.1" 404 1947

i add polls to installed apps. What else to do ??

2

2 Answers

1
votes

Path error. Problem solved. code should be in "mysite/mysite/urls.py" not in "mysite/urls.py"

0
votes

Probably you did'nt include the polls app properly in your project. Kindly post that line of code.