AttributeError at /home/home/ Exception Type: AttributeError at /home/home/
2015-06-02 23:30
405 查看
"错误提示信息":
Environment:
Request Method: GET Request URL: http://localhost:8000/home/home/
Django Version: 1.7.5 Python Version: 2.7.0 Installed Applications: ('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!'})
Environment:
Request Method: GET Request URL: http://localhost:8000/home/home/
Django Version: 1.7.5 Python Version: 2.7.0 Installed Applications: ('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!'})
相关文章推荐
- 指针式压力表自动读数:Auto Read the Value of Manometer
- Zookeeper基本原理
- Mac OS X Yosemite 10.10.2使用cgdb初步
- maven使用
- 使用DirectShow播放MP3,实现循环播放,显示播放进度
- Android入门级编译错误汇总
- 《Spring2之站立会议5》
- ASP.NETC#通用扩展函数之TypeParse 类型转换方便多了
- [LeetCode] Binary Tree Level Order Traversal
- 五大常用算法之四:回溯法
- 五大常用算法之五:分支限界法
- JSON和JSONP的区别
- MySQL索引的创建、删除和查看
- js输出单一字符字串
- php约瑟夫环
- jQuery 遍历同胞(siblings)
- TDSQL架构分析 分布式MySQL数据库
- iOS 事件传递
- PHP实现函数重载
- php 魔术方法