Forums

Django Tutorial: Page not found 404

I searched the forum history for a solution to this problem but was unsuccessful.

I am getting a django 404 error after reload, at the first section of the tutorial.

if I force the url to http://myusername.pythonanywhere.com/polls/ I get the expected output --Hello, world. You're at the polls index.--

I do not understand the gist of the url configuration so I do not know how to solve the problem.

<h1>~myProject/polls/urls.py has the following line</h1>

urlpatterns = [ path(' ', views.index, name='index'), ]

also

<h1>~myProject/myProject/urls.py has the following lines:</h1> urlpatterns = [ path('polls/', include('polls.urls')), path('admin/', admin.site.urls), ]

Your polls URLs are under /polls, so anything you define there will be under /polls. To define an actual index for the entire site, you need to do it in the same place as your project URLs (myProject/myProject/urls.py in your example above)

Thanks. I got it . I am slowly getting the hang of how the flow works.