2017-09-27 26 views
1

私はpython.Iの初心者です。エラーが発生し、何時間も苦労しています。/blog/index/'tuple'のAttributeErrorオブジェクトに 'get'属性がありません

AttributeError at /blog/index/ 
'tuple' object has no attribute 'get' 
Request Method: GET 
Request URL: http://localhost:8000/blog/index/ 
Django Version: 1.10.2 
Exception Type: AttributeError 

Exception Value:  
'tuple' object has no attribute 'get' 

Exception Location: 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/middleware/clickjacking.py in process_response, line 32 

Python Executable:/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python 
Python Version: 2.7.13 

そして、これはトレースバックです:

File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/handlers/exception.py" in inner 
39.    response = get_response(request) 

File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/deprecation.py" in __call__ 
135.    response = self.process_response(request, response) 

File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/middleware/clickjacking.py" in process_response 
32.   if response.get('X-Frame-Options') is not None: 

Exception Type: AttributeError at /blog/index/ 
Exception Value: 'tuple' object has no attribute 'get' 

これは単純なプロジェクトで、私はその後、私が構築され、ブログという新しいアプリ、およびブログでテンプレートという名前の新しいディレクトリを構築しましたテンプレート内のindex.html

のindex.html:

<h1>Hello blog</h1> 

blog.views:

from django.shortcuts import render 
from django.http import HttpResponse 

def index(request): 
    return render(request,'index.html'), 

設定:

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 

DEBUG = True 

ALLOWED_HOSTS = [] 

INSTALLED_APPS = [ 
'django.contrib.admin', 
'django.contrib.auth', 
'django.contrib.contenttypes', 
'django.contrib.sessions', 
'django.contrib.messages', 
'django.contrib.staticfiles', 
'blog'] 

enter image description here

答えて

2

あなたから末尾のカンマを削除します。

関連する問題