`AttributeError at /polls/
(/ polls /的AttributeError)
'str' object has no attribute 'get'
('str'对象没有属性'get')
Request Method: GET
(请求方法:GET)
Request URL: http://127.0.0.1:8000/polls/
(要求网址: http : //127.0.0.1 : 8000/polls/)
Django Version: 2.0.2
(Django版本:2.0.2)
Exception Type: AttributeError
(异常类型:AttributeError)
Exception Value: 'str' object has no attribute 'get'
(异常值:“ str”对象没有属性“ get”)
Exception Location: C:\Python34\lib\site-packages\django-2.0.2-py3.4.egg\django\middleware\clickjacking.py in process_response, line 26
(异常位置:process_response,第26行中的C:\ Python34 \ lib \ site-packages \ django-2.0.2-py3.4.egg \ django \ middleware \ clickjacking.py)
Python Executable: C:\Python34\python.exe
(Python可执行文件:C:\ Python34 \ python.exe)
Python Version: 3.4.1
(的Python版本:3.4.1)
Python Path: ['C:\Users\WUESE PHILIP\Desktop\vibezt',
(Python路径:['C:\ Users \ WUESE PHILIP \ Desktop \ vibezt',)
'C:\Python34\python34.zip',
('C:\ Python34 \ python34.zip',)
'C:\Python34\DLLs',
('C:\ Python34 \ DLLs',)
'C:\Python34\lib',
('C:\ Python34 \ lib',)
'C:\Python34',
('C:\ Python34',)
'C:\Python34\lib\site-packages',
('C:\ Python34 \ lib \ site-packages',)
'C:\Python34\lib\site-packages\setuptools-33.1.1-py3.4.egg',
('C:\ Python34 \ lib \ site-packages \ setuptools-33.1.1-py3.4.egg',)
'C:\Python34\lib\site-packages\django-2.0.2-py3.4.egg',
('C:\ Python34 \ lib \ site-packages \ django-2.0.2-py3.4.egg',)
'C:\Python34\lib\site-packages\pytz-2019.3-py3.4.egg']`
('C:\ Python34 \ lib \ site-packages \ pytz-2019.3-py3.4.egg']`)
polls urls.py
from django.urls import path
from . import views
`urlpatterns = [
(`urlpatterns = [)
path('', views.index, name='index'),
(path('',views.index,name ='index'),)
]`
(]`)
views.py
from django.shortcuts import render
`from django.http import HttpResponse
(从django.http导入HttpResponse)
def index(request):
(def索引(请求):)
return("<h2>Welcome to my First Python Django Project</h2>")`
vibezt urls.py
`from django.contrib import admin
(来自django.contrib的导入管理员)
from django.urls import include, path`
(从django.urls导入包括路径)
`urlpatterns = [
(`urlpatterns = [)
path('polls/', include('polls.urls')),
(path('polls /',include('polls.urls')),)
path('admin/', admin.site.urls),
(路径(“ admin /”,admin.site.urls),)
]`
(]`)
ask by Wuese Philip translate from so