New to Django, Tutiorial01 not working,

37 views
Skip to first unread message

Bryan Zimmer

unread,
Mar 29, 2018, 2:51:03 PM3/29/18
to Django users
Hello all,

I managed to get Django and mod_wsgi installed OK. I then followed through with tutorial01, but even though I tried it twice, on two different machines, I have come up blank.

This is the output I am getting for the first cut of Tutorial 01.

I am using Django 2.0.3 with python3.6 and mod_wsgi. 4.6.3:

Page not found (404)

Request Method: GET
Request URL: http://localhost:8000/

Using the URLconf defined in pollapp.urls, Django tried these URL patterns, in this order:

  1. polls/
  2. 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.


Here is my pollap.urls:

------------------------------------------------------------------------------------------------------------------

$ cat urls.py


"""pollapp URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import include, path

urlpatterns = [
    path('polls/',include('polls.urls')),   
    path('admin/', admin.site.urls),
]
---------------------------------------------------------------------------------------------------------------
The other relevant files, which I edited myself, following along with Tutorial01 are included as attachments.


I have scoped and squinted, and it still looks to me as though I didn't make any mistakes in editing the source code.

If I missed something, I'll be embarrassed, but I think I followed the instructions entirely the way they were written.


urls.py
views.py

prince gosavi

unread,
Mar 29, 2018, 4:30:54 PM3/29/18
to Django users
You need to use the following url http://localhost:8000/polls/ as you have mentioned that you want to go under the "polls/" django parses through the urls to find "/polls/"
and if it does not exists it will surely give an error as you are requesting things that it does not have.

Marcin Bacławski

unread,
Mar 29, 2018, 5:15:33 PM3/29/18
to Django users
u probably run http://localhost:8000/  ,u should  run http://localhost:8000/polls
Reply all
Reply to author
Forward
0 new messages