from . import views
urlpatterns = [
path('', views.index, name='index')
]
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def index(request):
return HttpResponse("Hello, world. You're at the polls index.")
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:
- 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.
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.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2bf99879-93ea-41cd-ae3a-d7b894fcd9d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment