Сделал все как написано
Файл polls/views.py
from django.http import HttpResponse
def index(request):
return HttpResponse("Hello, world. You're at the polls index.")
Файл polls/urls.py
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
]
Файл mysite/urls.py
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^polls/', include('polls.urls')),
url(r'^admin/', include(admin.site.urls)),
]
Но когда перехожу по ссылке http://localhost:8000/polls/ вместо текста “Hello, world. You’re at the poll index.” выдает ошибку:
Page not found (404)
Request Method: GET
Request URL: http://localhost:8000/polls/
Using the URLconf defined in mesite.urls, Django tried these URL patterns, in this order:
^admin/
The current URL, polls/, didn't match any of these.
В чем проблема, что нужно сделать?
Updated 15 July 2015, 16:32 by catchampion.