I have trouble getting the correct respond while I following the tutoriala link I can't get into the views whenever I run server. Please help me go through my code. I am not sure is it the problem with the version of django that I'm using and the one the tutorial is using because I notice the one in the tutorial using from django.urls import path but when I start an app it comes with from django.conf.urls. There's the different and I'm confused.
Request Method: GET
Request URL: http://127.0.0.1:8000/polls/
Django Version: 1.11.6
Python Version: 3.6.3
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback:
File "c:\users\CaddyKKhaw\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\handlers\exception.py" in inner 41. response = get_response(request)
File "c:\users\Caddy KKhaw\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\deprecation.py" in __call__ 142. response =
self.process_response(request, response)
File "c:\users\Caddy KKhaw\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\middleware\clickjacking.py" in process_response 32. if response.get('X-Frame-Options') is not
None:
Exception Type: AttributeError at /polls/
Exception Value: 'tuple' object has no attribute 'get'
Here's my polls/views.py
from django.http import HttpResponse
def index(request):
return HttpResponse("You did it this time!,"),
Here's my polls/urls.py
from django.conf.urls import url
from . import views
urlpatterns = [
url('', views.index, name="index")
]
here's my mysite/urls.py
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^polls/', include("polls.urls")),
url(r'^admin/', admin.site.urls),
]