From ea90d9989ea91e187c87e1474bd74e0833006242 Mon Sep 17 00:00:00 2001 From: JasonHomeWorkstationUbuntu Date: Sun, 18 Oct 2020 20:44:01 +1100 Subject: [PATCH] Finished part 1: created a single view --- mysite/mysite/urls.py | 3 ++- mysite/polls/urls.py | 7 +++++++ mysite/polls/views.py | 5 ++++- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 mysite/polls/urls.py diff --git a/mysite/mysite/urls.py b/mysite/mysite/urls.py index e7f9f35..2164217 100644 --- a/mysite/mysite/urls.py +++ b/mysite/mysite/urls.py @@ -14,8 +14,9 @@ Including another URLconf 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin -from django.urls import path +from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), + path('polls/', include('polls.urls')), ] diff --git a/mysite/polls/urls.py b/mysite/polls/urls.py new file mode 100644 index 0000000..3ef24d9 --- /dev/null +++ b/mysite/polls/urls.py @@ -0,0 +1,7 @@ +from django.urls import path + +from . import views + +urlpatterns = [ + path('', views.index, name='index'), +] \ No newline at end of file diff --git a/mysite/polls/views.py b/mysite/polls/views.py index c53ddeb..ad2c866 100644 --- a/mysite/polls/views.py +++ b/mysite/polls/views.py @@ -1,2 +1,5 @@ -from django.http import request +from django.http import request, HttpResponse from django.shortcuts import render + +def index(request): + return HttpResponse("Hello, world. You're at the polls index") \ No newline at end of file