0

I am going throught the Django tutorial here:

https://docs.djangoproject.com/en/1.10/intro/tutorial01/

I follow the instructions exactly. But when I try to go to http://localhost:8000/polls/, I don't see the message “Hello, world. You’re at the polls index.” as expected. Instead, I get the following error:

Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order: ^admin/ The current URL, polls/, didn't match any of these.

Here is my mysite/urls.py file. I am not sure why the first regex pattern in urlpatterns is not recognized.

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),
]
4
  • 2
    whats in your polls.url i.e. /polls/urls.py Commented Feb 25, 2017 at 5:16
  • from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.index, name='index'), ] Commented Feb 25, 2017 at 7:00
  • check this link if it helps stackoverflow.com/questions/25716185/… Commented Feb 25, 2017 at 7:06
  • Yes that did help. Thank you! In mysite/settings.py, I changed the ROOT_URLCONF variable from 'mysite.urls' to 'urls'. Commented Feb 26, 2017 at 0:42

1 Answer 1

-1

You might have forgot .html extension in views.py while requesting the page.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.