Hi I am new to programming. I am following Django official tutorial along with PythonAnywhere Tutorial. I followed each step and managed to see the page with little rocket and message saying "The install worked successfully! Congratulations!".
Then I went further by 1) Creating the Polls app
python manage.py startapp polls
2) Write your first view
polls/views.py
from django.http import HttpResponse
def index(request):
return HttpResponse("Hello, world. You're at the polls index.")
In the polls/urls.py file include the following code:
polls/urls.py
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
]
mysite/urls.py
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('polls/', include('polls.urls')),
path('admin/', admin.site.urls),
]
3) Instead of this command >> $ python manage.py runserver , I reloaded the page from the web app configuration page and got the following result:-
Page not found (404) Request Method: GET Request URL: http://bnyrj.pythonanywhere.com/ Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order: polls/ admin/ The empty path didn't match any of these. You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
Please advise me what went wrong?