AttributeErrorat/home/home/ExceptionType:AttributeErrorat/home/home/

王朝学院·作者佚名  2016-08-27
窄屏简体版  字體: 小  |  中  |  大  |  超大  

"错误提示信息":

Environment:

Request Method: GET Request URL: http://localhost:8000/home/home/

Django Version: 1.7.5 Python Version: 2.7.0 Installedapplications: ('django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'home') Installed Middleware: ('django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware')

Traceback:

File "D:\Python27\lib\site-packages\django-1.7.5-py2.7.egg\django\core\handlers\base.py" in get_response

111. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "D:\Pythonweb\testweb\laji\home\views.py" in home

5. return render("templates/home.html", {}) File "D:\Python27\lib\site-packages\django-1.7.5-py2.7.egg\django\shortcuts.py" in render

46. context_instance = RequestContext(request, current_app=current_app) File "D:\Python27\lib\site-packages\django-1.7.5-py2.7.egg\django\template\context.py" in __init__

209. updates.update(PRocessor(request)) File "D:\Python27\lib\site-packages\django-1.7.5-py2.7.egg\django\core\context_processors.py" in debug

40. if settings.DEBUG and request.META.get('REMOTE_ADDR') in settings.INTERNAL_ipS:

Exception Type: AttributeError at /home/home/

Exception Value: 'str' object has no attribute 'META'

《------------------------------错误原因-------------------------》

views.py 中的返回值不正确

def home(request):

return render("templates/home.html", {})

换成

def home(request):

#return render("templates/home.html", {})

return render_to_response("home.html", {'song': 'Take me to your heart!'})

 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝網路 版權所有 導航